]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
LoongArch: Reword message for unresolvable relocs
authorXi Ruoyao <xry111@xry111.site>
Wed, 25 Dec 2024 04:41:45 +0000 (12:41 +0800)
committercailulu <cailulu@loongson.cn>
Fri, 27 Dec 2024 09:52:29 +0000 (17:52 +0800)
commite2cbacaec110371172969e756ed7ab758d04c797
treed8d8aa765a4aebe169e1ebe24b76cc17d069b319
parentc1a964051be5471d91bfe7655155948ab9c653f8
LoongArch: Reword message for unresolvable relocs

For PDE, "recompiling with -fPIE" just makes no sense.

For PIE, "recompiling with -fPIE" makes sense for unresolvable absolute
relocs, but not unresolveable PC-relative relocs: if the reloc is
already PC-relative, the problem is not the reloc is PC-relative or
absolute, but the reloc is not applicable for external symbols.

If we hit an unresolvable reloc in PDE or an unresolvable PC-relative
reloc in PIE, it means the programmer has somehow wrongly instructed the
compiler to treat external symbols as local symbols.  A misuse of
-mdirect-extern-access can cause the issue, so we can suggest
-mno-direct-extern-access.  And in all cases (DSO/PIE/PDE) a mismatching
symbol visibility can also cause the issue, so we should also suggest to
check the visibility.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
bfd/elfnn-loongarch.c
ld/testsuite/ld-loongarch-elf/bad_pcala_hi20_global.d
ld/testsuite/ld-loongarch-elf/bad_pcala_hi20_global_pie.d
ld/testsuite/ld-loongarch-elf/bad_pcala_hi20_weak.d
ld/testsuite/ld-loongarch-elf/bad_pcala_hi20_weak_pie.d
ld/testsuite/ld-loongarch-elf/bad_pcrel20_s2_global.d
ld/testsuite/ld-loongarch-elf/bad_pcrel20_s2_weak.d