Add ld-x86-64/pie2 test
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 20 Apr 2016 18:12:06 +0000 (11:12 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 20 Apr 2016 18:12:22 +0000 (11:12 -0700)
* testsuite/ld-x86-64/pie2.d: New file.
* testsuite/ld-x86-64/pie2.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pie2.

ld/ChangeLog
ld/testsuite/ld-x86-64/pie2.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pie2.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp

index efa69f95efebf44848c6170202257d9820f7ed70..0ce4e2dcc4464e9ddf6dec9930fa3a357c12d5d7 100644 (file)
@@ -1,3 +1,9 @@
+2016-04-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * testsuite/ld-x86-64/pie2.d: New file.
+       * testsuite/ld-x86-64/pie2.s: Likewise.
+       * testsuite/ld-x86-64/x86-64.exp: Run pie2.
+
 2016-04-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/19969
diff --git a/ld/testsuite/ld-x86-64/pie2.d b/ld/testsuite/ld-x86-64/pie2.d
new file mode 100644 (file)
index 0000000..ef9f58a
--- /dev/null
@@ -0,0 +1,3 @@
+#as: --64
+#ld: -pie -melf_x86_64
+#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a shared object; recompile with -fPIC
diff --git a/ld/testsuite/ld-x86-64/pie2.s b/ld/testsuite/ld-x86-64/pie2.s
new file mode 100644 (file)
index 0000000..7c489a1
--- /dev/null
@@ -0,0 +1,8 @@
+       .text
+       .global _start
+_start:
+       .long foo
+       .data
+       .globl foo
+foo:
+       .byte 0
index fbd39afa9e9f642f409c89f90cb871eaad1122d9..b923fba4e47bd93956d29dd7ad4e6a087d0f8c82 100644 (file)
@@ -249,6 +249,7 @@ run_dump_test "pr14215"
 run_dump_test "pr14207"
 run_dump_test "gotplt1"
 run_dump_test "pie1"
+run_dump_test "pie2"
 run_dump_test "largecomm-1a"
 run_dump_test "largecomm-1b"
 run_dump_test "largecomm-1c"