aboutsummaryrefslogtreecommitdiff
path: root/ld/ldctor.c
diff options
context:
space:
mode:
authorJim Wilson <jimw@sifive.com>2019-09-20 15:01:20 -0700
committerJim Wilson <jimw@sifive.com>2019-09-20 15:01:20 -0700
commit9d1da81b261a20050ef2ad01a5b4c8cf78404222 (patch)
treebc9c73aaa8be63ebed399e1d3666a7fc84811883 /ld/ldctor.c
parentabf516c6931af1683d1e51203de1ca01467f9f85 (diff)
downloadgdb-9d1da81b261a20050ef2ad01a5b4c8cf78404222.zip
gdb-9d1da81b261a20050ef2ad01a5b4c8cf78404222.tar.gz
gdb-9d1da81b261a20050ef2ad01a5b4c8cf78404222.tar.bz2
RISC-V: Optimize lui and auipc relaxations for undefweak symbol.
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.
Diffstat (limited to 'ld/ldctor.c')
0 files changed, 0 insertions, 0 deletions