LoongArch: Adapt R_LARCH_{PCALA,GOT,TLS_IE,TLS_DESC}64_* handling per psABI v2.30
commit6590ec8097ce2740000ec120a0f8cd1920a4ad27
authorXi Ruoyao <xry111@xry111.site>
Tue, 16 Jan 2024 07:00:16 +0000 (16 15:00 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Wed, 17 Jan 2024 07:15:33 +0000 (17 15:15 +0800)
treefd3a625452d329177a2c32b16b28473832bdd931
parent5e35a3a8bb63c946c1c198feb180c697b06649fa
LoongArch: Adapt R_LARCH_{PCALA,GOT,TLS_IE,TLS_DESC}64_* handling per psABI v2.30

In LoongArch psABI v2.30, an offset (-8 for LO20 and -12 for HI12)
should be applied on PC for these reloc types to avoid wrong relocation
when the instruction sequence crosses a page boundary.

The lld linker has already adapted the change.  Make it for the bfd
linker too.

Link: https://github.com/loongson/la-abi-specs/releases/v2.30
Link: https://github.com/loongson-community/discussions/issues/17
Link: https://github.com/llvm/llvm-project/pull/73387
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
bfd/elfnn-loongarch.c
ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
ld/testsuite/ld-loongarch-elf/pcala64.d [new file with mode: 0644]
ld/testsuite/ld-loongarch-elf/pcala64.s [new file with mode: 0644]