[PATCH 0/3] LoongArch: Allow and correctly resolve PC-relative relocs against local undefined weak symbols

Xi Ruoyao xry111@xry111.site
Fri Dec 13 05:53:49 GMT 2024


Prompted by https://lore.kernel.org/loongarch/20241206085810.112341-1-chenhuacai@loongson.cn/.

Cc: mengqinggang@loongson.cn
Cc: Lulu Cai <cailulu@loongson.cn>
Cc: Chenghua Xu <xuchenghua@loongson.cn>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>

Xi Ruoyao (3):
  LoongArch: Fix resolution of undefined weak hidden/protected symbols
  LoongArch: Allow R_LARCH_PCALA_HI20 or R_LARCH_PCREL20_S2 against
    undefined weak symbols for static PIE
  LoongArch: Reword message for unresolvable PC-relative relocs

 bfd/elfnn-loongarch.c                         | 104 +++++++++++++-----
 include/opcode/loongarch.h                    |   2 +
 .../ld-loongarch-elf/bad_pcala_hi20_global.d  |   2 +-
 .../bad_pcala_hi20_global_pie.d               |   2 +-
 .../ld-loongarch-elf/bad_pcala_hi20_weak.d    |   2 +-
 .../bad_pcala_hi20_weak_pie.d                 |   2 +-
 .../ld-loongarch-elf/bad_pcrel20_s2_global.d  |   2 +-
 .../ld-loongarch-elf/bad_pcrel20_s2_weak.d    |   2 +-
 .../ld-loongarch-elf/ld-loongarch-elf.exp     |   3 +
 .../ld-loongarch-elf/weak-undef-hidden-pie.d  |  14 +++
 .../weak-undef-hidden-shared.d                |  14 +++
 .../ld-loongarch-elf/weak-undef-hidden.s      |   9 ++
 .../ld-loongarch-elf/weak-undef-static-pie.d  |  13 +++
 .../ld-loongarch-elf/weak-undef-static-pie.s  |   8 ++
 14 files changed, 147 insertions(+), 32 deletions(-)
 create mode 100644 ld/testsuite/ld-loongarch-elf/weak-undef-hidden-pie.d
 create mode 100644 ld/testsuite/ld-loongarch-elf/weak-undef-hidden-shared.d
 create mode 100644 ld/testsuite/ld-loongarch-elf/weak-undef-hidden.s
 create mode 100644 ld/testsuite/ld-loongarch-elf/weak-undef-static-pie.d
 create mode 100644 ld/testsuite/ld-loongarch-elf/weak-undef-static-pie.s

-- 
2.47.1



More information about the Binutils mailing list