aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-x86-64
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-x86-64')
-rw-r--r--ld/testsuite/ld-x86-64/plt-main-bnd.dd7
-rw-r--r--ld/testsuite/ld-x86-64/plt-main.rd4
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp65
3 files changed, 76 insertions, 0 deletions
diff --git a/ld/testsuite/ld-x86-64/plt-main-bnd.dd b/ld/testsuite/ld-x86-64/plt-main-bnd.dd
new file mode 100644
index 0000000..8598e30
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/plt-main-bnd.dd
@@ -0,0 +1,7 @@
+#...
+Disassembly of section .plt.got:
+
+[a-f0-9]+ <.plt.got>:
+[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <_DYNAMIC\+0x...>
+[ ]*[a-f0-9]+: 90 nop
+#pass
diff --git a/ld/testsuite/ld-x86-64/plt-main.rd b/ld/testsuite/ld-x86-64/plt-main.rd
new file mode 100644
index 0000000..1effcd4
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/plt-main.rd
@@ -0,0 +1,4 @@
+#failif
+#...
+[0-9a-f ]+R_X86_64_JUMP_SLOT +0+ +bar \+ 0
+#...
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index ab1bfd1..886469b 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -374,6 +374,24 @@ if { [isnative] && [which $CC] != 0 } {
{{readelf {-Wr} plt-main4.rd}} \
"libplt-main4.a" \
] \
+ [list \
+ "Build plt-main" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
+ "" \
+ { plt-main5.c } \
+ {{readelf {-Wr} plt-main.rd}} \
+ "plt-main" \
+ ] \
+ [list \
+ "Build plt-main with PIE" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so -pie" \
+ "-fPIC" \
+ { plt-main5.c } \
+ {{readelf {-Wr} plt-main.rd}} \
+ "plt-main" \
+ ] \
]
run_ld_link_exec_tests [] [list \
@@ -397,6 +415,53 @@ if { [isnative] && [which $CC] != 0 } {
"-fPIC" \
] \
]
+
+ if { [istarget "x86_64-*-linux*"] \
+ && ![istarget "x86_64-*-linux*-gnux32"]} {
+
+ run_cc_link_tests [list \
+ [list \
+ "Build plt-main with -z bndplt" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt" \
+ "" \
+ { plt-main5.c } \
+ {{objdump {-drw} plt-main-bnd.dd}} \
+ "plt-main-bnd" \
+ ] \
+ [list \
+ "Build plt-main with PIE and -z bndplt" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -pie" \
+ "-fPIC" \
+ { plt-main5.c } \
+ {{objdump {-drw} plt-main-bnd.dd}} \
+ "plt-main-pie-bnd" \
+ ] \
+ ]
+
+ run_ld_link_exec_tests [] [list \
+ [list \
+ "Run plt-main with -z bndplt" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt" \
+ "" \
+ { plt-main5.c } \
+ "plt-main-bnd" \
+ "plt-main.out" \
+ ] \
+ [list \
+ "Run plt-main with PIE and -z bndplt" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -pie" \
+ "" \
+ { plt-main5.c } \
+ "plt-main-pie-bnd" \
+ "plt-main.out" \
+ "-fPIC" \
+ ] \
+ ]
+ }
}
if { ![istarget "x86_64-*-linux*"]} {