]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Add -X to link spec
authorFangrui Song <maskray@gcc.gnu.org>
Sat, 27 Apr 2024 01:14:33 +0000 (18:14 -0700)
committerFangrui Song <maskray@google.com>
Sat, 27 Apr 2024 01:14:33 +0000 (18:14 -0700)
commit50c218e3ffe57860591a987ecf44fcc0abb31f2c
treed128a0543a2d3d3c2e646e411ea296f2a82b2840
parent2781d8090e66f1e60bedb597e9472d1bc0a9df19
RISC-V: Add -X to link spec

--discard-locals (-X) instructs the linker to remove local .L* symbols,
which occur a lot due to label differences for linker relaxation. The
arm port has a similar need and passes -X to ld.

In contrast, the RISC-V port does not pass -X to ld and rely on the
default --discard-locals in GNU ld's riscv port. The arm way is more
conventional (compiler driver instead of the linker customizes the
default linker behavior) and works with lld.

gcc/ChangeLog:

* config/riscv/elf.h (LINK_SPEC): Add -X.
* config/riscv/freebsd.h (LINK_SPEC): Add -X.
* config/riscv/linux.h (LINK_SPEC): Add -X.
gcc/config/riscv/elf.h
gcc/config/riscv/freebsd.h
gcc/config/riscv/linux.h