binutils-gdb/ld/testsuite/ld-riscv-elf/pcrel-lo-addend.s
Jim Wilson 2a0d985349 RISC-V: Give error for ignored pcrel_lo addend.
bfd/
	* elfnn-riscv.c (riscv_elf_relocate_section): Use bfd_reloc_dangerous
	when pcrel_lo reloc has an addend.  Use reloc_dangerous callback for
	bfd_reloc_dangerous.  Use einfo instead of warning callback for errors.
	Add %X%P to error messages.

	ld/
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run pcrel-lo-addend test.
	* testsuite/ld-riscv-elf/pcrel-lo-addend.d: New.
	* testsuite/ld-riscv-elf/pcrel-lo-addend.s: New.
2018-02-15 10:53:46 -08:00

18 lines
260 B
ArmAsm

.text
.globl _start
_start:
auipc ra, %pcrel_hi(tdata)
addi ra, ra, %pcrel_lo(.text)
lb t1, 0(ra)
foo:
auipc ra, %pcrel_hi(tdata)
addi ra, ra, %pcrel_lo(.text+12)
lb t2, 1(ra)
.data
tdata:
.byte 0xff
.byte 0x00
.byte 0xf0
.byte 0x0f