aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authormengqinggang <mengqinggang@loongson.cn>2024-01-25 09:32:14 +0800
committerliuzhensong <liuzhensong@loongson.cn>2024-01-26 16:49:09 +0800
commita0aa6f4abd649768d6d028da1f953c96bac0c94f (patch)
tree0f9c121270677c167abc6dbc52face76c2082fee /ld/testsuite
parente14f7abaf81d5d0aa7898570024286de8c188817 (diff)
downloadgdb-a0aa6f4abd649768d6d028da1f953c96bac0c94f.zip
gdb-a0aa6f4abd649768d6d028da1f953c96bac0c94f.tar.gz
gdb-a0aa6f4abd649768d6d028da1f953c96bac0c94f.tar.bz2
LoongArch: ld: Add support for TLS LE symbol with addend
Add support for TLS LE symbol with addend, such as: lu12i.w $t0, %le_hi20(a + 0x8) ori $t0, $t0, %le_lo12(a + 0x8)
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp1
-rw-r--r--ld/testsuite/ld-loongarch-elf/tls-le.d14
-rw-r--r--ld/testsuite/ld-loongarch-elf/tls-le.s18
3 files changed, 33 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 1b5994c..3ae0d9d 100644
--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
+++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
@@ -34,6 +34,7 @@ if [istarget "loongarch64-*-*"] {
run_dump_test "local-ifunc-reloc"
run_dump_test "anno-sym"
run_dump_test "pcala64"
+ run_dump_test "tls-le"
}
if [istarget "loongarch32-*-*"] {
diff --git a/ld/testsuite/ld-loongarch-elf/tls-le.d b/ld/testsuite/ld-loongarch-elf/tls-le.d
new file mode 100644
index 0000000..cbd6adb
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/tls-le.d
@@ -0,0 +1,14 @@
+#ld: --no-relax
+#objdump: -d
+
+.*:[ ]+file format .*
+
+
+Disassembly of section .text:
+
+[ ]*00000001200000e8 <_start>:
+[ ]+1200000e8:[ ]+14000004[ ]+lu12i.w[ ]+\$a0, 0
+[ ]+1200000ec:[ ]+03802085[ ]+ori[ ]+\$a1, \$a0, 0x8
+[ ]+1200000f0:[ ]+14000004[ ]+lu12i.w[ ]+\$a0, 0
+[ ]+1200000f4:[ ]+02c02085[ ]+addi.d[ ]+\$a1, \$a0, 8
+[ ]+1200000f8:[ ]+4c000020[ ]+ret
diff --git a/ld/testsuite/ld-loongarch-elf/tls-le.s b/ld/testsuite/ld-loongarch-elf/tls-le.s
new file mode 100644
index 0000000..2e6a9de
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/tls-le.s
@@ -0,0 +1,18 @@
+# Support for TLS LE symbols with addend
+ .text
+ .globl a
+ .section .tdata,"awT",@progbits
+ .align 2
+ .type a, @object
+ .size a, 4
+a:
+ .word 123
+
+ .text
+ .global _start
+_start:
+ lu12i.w $r4,%le_hi20(a + 0x8)
+ ori $r5,$r4,%le_lo12(a + 0x8)
+ lu12i.w $r4,%le_hi20_r(a + 0x8)
+ addi.d $r5,$r4,%le_lo12_r(a + 0x8)
+ jr $ra