RISC-V: Enable x0 base relaxation for relax_pc even if --no-relax-gp.
authorNelson Chu <nelson@rivosinc.com>
Fri, 21 Apr 2023 08:28:39 +0000 (16:28 +0800)
committerNelson Chu <nelson@rivosinc.com>
Fri, 28 Apr 2023 06:27:35 +0000 (14:27 +0800)
commit03e63766ef099ba85d8917c9f179441ae086375e
tree56c13570cb263ba14b59f435e8a7cdfe0e8db98a
parenta48ddc3b572eb7fd9325867c4946f6bbb1f9b5b4
RISC-V: Enable x0 base relaxation for relax_pc even if --no-relax-gp.

Let --no-relax-gp only disable the gp relaxation for lui and pcrel
relaxations, since x0 base and gp relaxations are different optimizations
in fact, but just use the same function to handle.

bfd/
* elfnn-riscv.c (_bfd_riscv_relax_pc): Like _bfd_riscv_relax_lui,
set gp to zero when --no-relax-gp, then we should still keep the
x0 base relaxation.
(_bfd_riscv_relax_section): Enable _bfd_riscv_relax_pc when
--no-relax-gp, we will disable the gp relaxation in the
_bfd_riscv_relax_pc.
bfd/elfnn-riscv.c