aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorliuzhensong <liuzhensong@loongson.cn>2022-08-19 15:04:45 +0800
committerliuzhensong <liuzhensong@loongson.cn>2022-08-24 14:27:03 +0800
commit42bd5254fb5f52f045796e1d9cce07102881d3b1 (patch)
tree32613c1472e87894f69dd3aaae41a1bcab95a94b /ld
parent044193ebf6a2197a36c75cbc1ec7e77440a37b26 (diff)
downloadgdb-42bd5254fb5f52f045796e1d9cce07102881d3b1.zip
gdb-42bd5254fb5f52f045796e1d9cce07102881d3b1.tar.gz
gdb-42bd5254fb5f52f045796e1d9cce07102881d3b1.tar.bz2
LoongArch: ld: Fix bug not generate plt when link a dso
Fix the bug that can not generate func@plt when linking a undefined function with cmodel=medium. Add testcase. bfd/ * elfnn-loongarch.c ld/testsuite/ld-loongarch-elf/ * cmodel-libjirl.dd * cmodel.exp * libjirl.s
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ld-loongarch-elf/cmodel-libjirl.dd4
-rw-r--r--ld/testsuite/ld-loongarch-elf/cmodel.exp37
-rw-r--r--ld/testsuite/ld-loongarch-elf/libjirl.s2
3 files changed, 43 insertions, 0 deletions
diff --git a/ld/testsuite/ld-loongarch-elf/cmodel-libjirl.dd b/ld/testsuite/ld-loongarch-elf/cmodel-libjirl.dd
new file mode 100644
index 0000000..52d3dca
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/cmodel-libjirl.dd
@@ -0,0 +1,4 @@
+.*file format.*loongarch
+#...
+[0-9a-f]+ <func@plt>:
+#pass
diff --git a/ld/testsuite/ld-loongarch-elf/cmodel.exp b/ld/testsuite/ld-loongarch-elf/cmodel.exp
new file mode 100644
index 0000000..7ef972a
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/cmodel.exp
@@ -0,0 +1,37 @@
+# Expect script for LoongArch ELF linker tests
+# Copyright (C) 2022 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+if ![istarget loongarch*-*-*] {
+ return
+}
+
+run_ld_link_tests [list \
+ [list \
+ "medium jirl plt" \
+ "-shared" "" \
+ "" \
+ {libjirl.s} \
+ [list \
+ [list objdump -d cmodel-libjirl.dd] \
+ ] \
+ "libjirl.so" \
+ ] \
+ ]
diff --git a/ld/testsuite/ld-loongarch-elf/libjirl.s b/ld/testsuite/ld-loongarch-elf/libjirl.s
new file mode 100644
index 0000000..4d96387
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/libjirl.s
@@ -0,0 +1,2 @@
+pcalau12i $r12, %pc_hi20(func)
+jirl $r1,$r12, %pc_lo12(func)