diff options
author | Xi Ruoyao <xry111@xry111.site> | 2024-01-16 15:00:16 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2024-01-17 15:15:33 +0800 |
commit | 6590ec8097ce2740000ec120a0f8cd1920a4ad27 (patch) | |
tree | fd3a625452d329177a2c32b16b28473832bdd931 /ld | |
parent | 5e35a3a8bb63c946c1c198feb180c697b06649fa (diff) | |
download | gdb-6590ec8097ce2740000ec120a0f8cd1920a4ad27.zip gdb-6590ec8097ce2740000ec120a0f8cd1920a4ad27.tar.gz gdb-6590ec8097ce2740000ec120a0f8cd1920a4ad27.tar.bz2 |
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>
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/pcala64.d | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/pcala64.s | 8 |
3 files changed, 24 insertions, 0 deletions
diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp index 2956007..1b5994c 100644 --- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp +++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp @@ -33,6 +33,7 @@ if [istarget "loongarch64-*-*"] { run_dump_test "disas-jirl" run_dump_test "local-ifunc-reloc" run_dump_test "anno-sym" + run_dump_test "pcala64" } if [istarget "loongarch32-*-*"] { diff --git a/ld/testsuite/ld-loongarch-elf/pcala64.d b/ld/testsuite/ld-loongarch-elf/pcala64.d new file mode 100644 index 0000000..e0e9819 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/pcala64.d @@ -0,0 +1,15 @@ +#ld: -Ttext=0x180000ff8 -Tdata=0x1000000000 +#objdump: -d + +.*:[ ]+file format .* + + +Disassembly of section .text: + +0000000180000ff8 <_start>: +[ ]+180000ff8:[ ]+1b000004[ ]+pcalau12i[ ]+\$a0,[ ]+-524288 +[ ]+180000ffc:[ ]+02c0000c[ ]+li.d[ ]+\$t0,[ ]+0 +[ ]+180001000:[ ]+160001ec[ ]+lu32i.d[ ]+\$t0,[ ]+15 +[ ]+180001004:[ ]+0300018c[ ]+lu52i.d[ ]+\$t0,[ ]+\$t0,[ ]+0 +[ ]+180001008:[ ]+0010b084[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$t0 +[ ]+18000100c:[ ]+4c000020[ ]+ret diff --git a/ld/testsuite/ld-loongarch-elf/pcala64.s b/ld/testsuite/ld-loongarch-elf/pcala64.s new file mode 100644 index 0000000..dfef0e2 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/pcala64.s @@ -0,0 +1,8 @@ +.text +.globl _start +_start: + la.pcrel $a0, $t0, sym + jr $ra +.data +sym: + .dword 0 |