RISC-V: Allow pcrel_lo addends, error on addend overflow.
authorJim Wilson <jimw@sifive.com>
Mon, 24 Sep 2018 21:05:32 +0000 (14:05 -0700)
committerJim Wilson <jimw@sifive.com>
Mon, 24 Sep 2018 21:05:32 +0000 (14:05 -0700)
commit551703cfd409faca433626a0af077a43011381b7
tree8ef7b1c2a1592262b8bc2df357f92be83cbafe3b
parentdb72737006fc383cb8838bf7f3dc8e641e60c38f
RISC-V: Allow pcrel_lo addends, error on addend overflow.

bfd/
* elfnn-riscv.c (riscv_resolve_pcrel_lo_relocs): Add check for reloc
overflow with addend.  Use reloc_dangerous instead of reloc_overflow.
Add strings for the two errors handled here.
(riscv_elf_relocate_section) In case R_RISCV_PCREL_LO12_I, rewrite
comment.  Only give error with addend when used with section symbol.
In case bfd_reloc_dangerous, update error string.

ld/
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run pcrel-lo-addend-2.
* testsuite/ld-riscv/elf/ld-riscv-elf/pcrel-lo-addend-2.d: New.
* testsuite/ld-riscv/elf/ld-riscv-elf/pcrel-lo-addend-2.s: New.
* testsuite/ld-riscv/elf/ld-riscv-elf/pcrel-lo-addend.d: Update name
and error string.
bfd/ChangeLog
bfd/elfnn-riscv.c
ld/ChangeLog
ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
ld/testsuite/ld-riscv-elf/pcrel-lo-addend-2.d [new file with mode: 0644]
ld/testsuite/ld-riscv-elf/pcrel-lo-addend-2.s [new file with mode: 0644]
ld/testsuite/ld-riscv-elf/pcrel-lo-addend.d