]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
LoongArch: Check PC-relative relocations for shared libraries
authorLulu Cai <cailulu@loongson.cn>
Mon, 30 Sep 2024 08:08:59 +0000 (16:08 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Thu, 17 Oct 2024 13:01:52 +0000 (21:01 +0800)
commit4cb77761d68791aa3fd9e7c0ec37fce86a4661f3
tree4f42397fc534c700475a7b6134742985fade00d6
parent7721dcad5c61b0ba7cc673958ae06315dc2ffa28
LoongArch: Check PC-relative relocations for shared libraries

Building shared libraries should not be allowed for PC-relative
relocations against external symbols.
Currently LoongArch has no corresponding checks and silently
generates wrong shared libraries.

However, In the first version of the medium cmodel, pcalau12i+jirl was
used for function calls, in which case PC-relative relocations were
allowed.
bfd/elfnn-loongarch.c
ld/testsuite/ld-loongarch-elf/bad_pcala_hi20_global.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/bad_pcala_hi20_global.s [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/bad_pcala_hi20_weak.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/bad_pcala_hi20_weak.s [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/bad_pcrel20_s2_global.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/bad_pcrel20_s2_global.s [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/bad_pcrel20_s2_weak.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/bad_pcrel20_s2_weak.s [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/data-plt.s
ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp