aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2024-06-30 15:18:23 +0800
committerliuzhensong <liuzhensong@loongson.cn>2024-07-05 12:11:11 +0800
commit17cae6980b15b96570908cebba29a04ab5e8ea41 (patch)
treef2f6e29f694a26c09d9dae057689cc7af91f9c96 /ld/testsuite
parent41ef0bff2033bb7b30a2792417aa946503492ce0 (diff)
downloadgdb-17cae6980b15b96570908cebba29a04ab5e8ea41.zip
gdb-17cae6980b15b96570908cebba29a04ab5e8ea41.tar.gz
gdb-17cae6980b15b96570908cebba29a04ab5e8ea41.tar.bz2
LoongArch: Make protected function symbols local for -shared
On LoongArch there is no reason to treat STV_PROTECTED STT_FUNC symbols as preemptible. See the comment above LARCH_REF_LOCAL for detailed explanation. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-loongarch-elf/ifunc-reloc.d2
-rw-r--r--ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp1
-rw-r--r--ld/testsuite/ld-loongarch-elf/protected-func.d6
-rw-r--r--ld/testsuite/ld-loongarch-elf/protected-func.s17
4 files changed, 25 insertions, 1 deletions
diff --git a/ld/testsuite/ld-loongarch-elf/ifunc-reloc.d b/ld/testsuite/ld-loongarch-elf/ifunc-reloc.d
index cb59287..968e756 100644
--- a/ld/testsuite/ld-loongarch-elf/ifunc-reloc.d
+++ b/ld/testsuite/ld-loongarch-elf/ifunc-reloc.d
@@ -8,6 +8,7 @@
.* R_LARCH_IRELATIVE .*
.* R_LARCH_IRELATIVE .*
.* R_LARCH_IRELATIVE .*
+.* R_LARCH_IRELATIVE .*
#...
.*'\.rela\.plt'.*
#...
@@ -16,4 +17,3 @@
.* R_LARCH_JUMP_SLOT .*
.* R_LARCH_JUMP_SLOT .*
.* R_LARCH_JUMP_SLOT .*
-.* R_LARCH_JUMP_SLOT .*
diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
index 6cff117..9a668fb 100644
--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
+++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
@@ -134,6 +134,7 @@ if [istarget "loongarch64-*-*"] {
run_dump_test "reloc_abs_with_shared"
run_dump_test "r_larch_32_elf64"
run_dump_test "ifunc-reloc"
+ run_dump_test "protected-func"
}
if [check_pie_support] {
diff --git a/ld/testsuite/ld-loongarch-elf/protected-func.d b/ld/testsuite/ld-loongarch-elf/protected-func.d
new file mode 100644
index 0000000..501c7cb
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/protected-func.d
@@ -0,0 +1,6 @@
+#ld: -shared
+#readelf: -Wr
+
+#...
+.* R_LARCH_RELATIVE .*
+.* R_LARCH_RELATIVE .*
diff --git a/ld/testsuite/ld-loongarch-elf/protected-func.s b/ld/testsuite/ld-loongarch-elf/protected-func.s
new file mode 100644
index 0000000..8f28f92
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/protected-func.s
@@ -0,0 +1,17 @@
+# protected function should be non-preemptible and relocated with
+# R_LARCH_RELATIVE in shared library, for both GOT and pointer data
+
+.globl x
+.protected x
+.type x, @function
+x:
+ ret
+
+.globl _start
+_start:
+ la.got $a0, x
+ ret
+
+.data
+p:
+ .quad x