binutils-gdb/ld/testsuite/ld-riscv-elf
Jim Wilson 080a488354 RISC-V: Fix lui relaxation issue with code at address 0.
This fixes a problem originally reported at
    https://github.com/riscv/riscv-binutils-gdb/issues/173

If you have code linked at address zero, you can have a lui instruction
loading a value 0x800 which gets relaxed to a c.lui which is valid (c.lui 0x1
followed by addi -0x800).  Relaxation can reduce the value below 0x800 at which
point the c.lui 0x0 is no longer valid.  We can fix this by converting the
c.lui to a c.li which can load 0.

	bfd/
	* elfnn-riscv.c (perform_relocation) <R_RISCV_RVC_LUI>: If
	RISCV_CONST_HIGH_PART (value) is zero, then convert c.lui instruction
	to c.li instruction, and use ENCODE_RVC_IMM to set value.

	ld/
	* testsuite/ld-riscv-elf/c-lui-2.d: New.
	* testsuite/ld-riscv-elf/c-lui-2.ld: New.
	* testsuite/ld-riscv-elf/c-lui-2.s: New.
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run the c-lui-2 test.
2019-08-15 12:01:13 -07:00
..
attr-merge-arch-01.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-01a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-01b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-02.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-02a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-02b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-03.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-03a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-03b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-failed-01.d Fix spelling mistakes in BFD library. 2019-01-21 12:39:24 +00:00
attr-merge-arch-failed-01a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-arch-failed-01b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-priv-spec-a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-priv-spec-b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-priv-spec.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-stack-align-a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-stack-align-b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-stack-align-failed-a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-stack-align-failed-b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-stack-align-failed.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-stack-align.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-01.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-01a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-01b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-02.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-02a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-02b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-03.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-03a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-03b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-04.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-04a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-04b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-05.d RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-05a.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
attr-merge-strict-align-05b.s RISC-V: Merge ELF attribute for ld. 2019-01-16 13:28:35 -08:00
c-lui-2.d RISC-V: Fix lui relaxation issue with code at address 0. 2019-08-15 12:01:13 -07:00
c-lui-2.ld RISC-V: Fix lui relaxation issue with code at address 0. 2019-08-15 12:01:13 -07:00
c-lui-2.s RISC-V: Fix lui relaxation issue with code at address 0. 2019-08-15 12:01:13 -07:00
c-lui.d RISC-V: Fix accidental embedded -shared regressions. 2018-01-08 17:55:29 -08:00
c-lui.s RISC-V: Fix accidental embedded -shared regressions. 2018-01-08 17:55:29 -08:00
disas-jalr.d RISC-V: Print symbol address for jalr w/ zero offset. 2018-01-05 17:51:23 -08:00
disas-jalr.s RISC-V: Print symbol address for jalr w/ zero offset. 2018-01-05 17:51:23 -08:00
gp-test-lib.sd Really fix riscv shared library __global_pointer$ problem. 2017-12-05 14:42:12 -08:00
gp-test.s Really fix riscv shared library __global_pointer$ problem. 2017-12-05 14:42:12 -08:00
gp-test.sd Really fix riscv shared library __global_pointer$ problem. 2017-12-05 14:42:12 -08:00
ld-riscv-elf.exp RISC-V: Fix lui relaxation issue with code at address 0. 2019-08-15 12:01:13 -07:00
pcrel-lo-addend-2.d RISC-V: Adjust __global_pointer$ value to reduce code size. 2018-10-15 16:00:28 -07:00
pcrel-lo-addend-2.s RISC-V: Allow pcrel_lo addends, error on addend overflow. 2018-09-24 14:05:32 -07:00
pcrel-lo-addend.d RISC-V: Allow pcrel_lo addends, error on addend overflow. 2018-09-24 14:05:32 -07:00
pcrel-lo-addend.s RISC-V: Give error for ignored pcrel_lo addend. 2018-02-15 10:53:46 -08:00
weakref32.d RISC-V: Handle out-of-range calls to undefined weak. 2018-06-03 15:42:29 -07:00
weakref32.s RISC-V: Handle out-of-range calls to undefined weak. 2018-06-03 15:42:29 -07:00
weakref64.d RISC-V: Handle out-of-range calls to undefined weak. 2018-06-03 15:42:29 -07:00
weakref64.s RISC-V: Handle out-of-range calls to undefined weak. 2018-06-03 15:42:29 -07:00
weakref.ld RISC-V: Handle out-of-range calls to undefined weak. 2018-06-03 15:42:29 -07:00