mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-06 12:09:26 +08:00
9d1da81b26
For the lui and auipc relaxations, since the symbol value of an undefined weak symbol is always be zero, we can optimize the patterns into a single LI/MV/ADDI instruction. bfd/ * elfnn-riscv.c (riscv_pcgp_hi_reloc): Add new field undefined_weak. (riscv_record_pcgp_hi_reloc): New parameter undefined_weak. Set undefined_weak field from it. (relax_func_t): New parameter undefined_weak. (_bfd_riscv_relax_call): New ignored parameter undefined_weak. (_bfd_riscv_relax_tls_le): Likewise. (_bfd_riscv_relax_align): Likewise. (_bfd_riscv_relax_delete): Likewise. (_bfd_riscv_relax_lui): New parameter undefined_weak. If true, allow relaxing. For LO12* relocs, set rs1 to x0 when undefined_weak. (_bfd_riscv_relax_pc): New parameter undefined_weak. For LO12* relocs, set undefined_weak from hi_reloc. If true, allow relaxing. For LO12* relocs, set rs1 to x0 when undefined_weak and change to non-pcrel reloc. (_bfd_riscv_relax_section): New local undefined_weak. Set for undef weak relocs that can be relaxed. Pass to relax_func call. ld/ * testsuite/ld-riscv-elf/weakref32.s: Add relaxable undef weak code. * testsuite/ld-riscv-elf/weakref64.s: Likewise. * testsuite/ld-riscv-elf/weakref32.d: Updated. * testsuite/ld-riscv-elf/weakref64.d: Updated. |
||
---|---|---|
.. | ||
attr-merge-arch-01.d | ||
attr-merge-arch-01a.s | ||
attr-merge-arch-01b.s | ||
attr-merge-arch-02.d | ||
attr-merge-arch-02a.s | ||
attr-merge-arch-02b.s | ||
attr-merge-arch-03.d | ||
attr-merge-arch-03a.s | ||
attr-merge-arch-03b.s | ||
attr-merge-arch-failed-01.d | ||
attr-merge-arch-failed-01a.s | ||
attr-merge-arch-failed-01b.s | ||
attr-merge-priv-spec-a.s | ||
attr-merge-priv-spec-b.s | ||
attr-merge-priv-spec.d | ||
attr-merge-stack-align-a.s | ||
attr-merge-stack-align-b.s | ||
attr-merge-stack-align-failed-a.s | ||
attr-merge-stack-align-failed-b.s | ||
attr-merge-stack-align-failed.d | ||
attr-merge-stack-align.d | ||
attr-merge-strict-align-01.d | ||
attr-merge-strict-align-01a.s | ||
attr-merge-strict-align-01b.s | ||
attr-merge-strict-align-02.d | ||
attr-merge-strict-align-02a.s | ||
attr-merge-strict-align-02b.s | ||
attr-merge-strict-align-03.d | ||
attr-merge-strict-align-03a.s | ||
attr-merge-strict-align-03b.s | ||
attr-merge-strict-align-04.d | ||
attr-merge-strict-align-04a.s | ||
attr-merge-strict-align-04b.s | ||
attr-merge-strict-align-05.d | ||
attr-merge-strict-align-05a.s | ||
attr-merge-strict-align-05b.s | ||
c-lui-2.d | ||
c-lui-2.ld | ||
c-lui-2.s | ||
c-lui.d | ||
c-lui.s | ||
disas-jalr.d | ||
disas-jalr.s | ||
gp-test-lib.sd | ||
gp-test.s | ||
gp-test.sd | ||
ld-riscv-elf.exp | ||
pcrel-lo-addend-2.d | ||
pcrel-lo-addend-2.s | ||
pcrel-lo-addend.d | ||
pcrel-lo-addend.s | ||
weakref32.d | ||
weakref32.s | ||
weakref64.d | ||
weakref64.s | ||
weakref.ld |