i386: Add tests for PIE with undefined weak symbol
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 17 Jul 2017 19:42:32 +0000 (12:42 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 17 Jul 2017 19:42:32 +0000 (12:42 -0700)
* testsuite/ld-i386/i386.exp: Run pie1 and pie1-nacl.
* testsuite/ld-i386/pie1-nacl.d: New file.
* testsuite/ld-i386/pie1.d: Likewise.
* testsuite/ld-i386/pie1.s: Likewise.

ld/ChangeLog
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/pie1-nacl.d [new file with mode: 0644]
ld/testsuite/ld-i386/pie1.d [new file with mode: 0644]
ld/testsuite/ld-i386/pie1.s [new file with mode: 0644]

index 735fdeb33b71b21b923fdb393978b9e1f1fd1bcd..ba03ae40cc3ca22e164575400d9187280e3cd615 100644 (file)
@@ -1,3 +1,10 @@
+2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * testsuite/ld-i386/i386.exp: Run pie1 and pie1-nacl.
+       * testsuite/ld-i386/pie1-nacl.d: New file.
+       * testsuite/ld-i386/pie1.d: Likewise.
+       * testsuite/ld-i386/pie1.s: Likewise.
+
 2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/21782
index 6c53046193ae75f9ecee484900bc7e05838d1fcc..ba39fc132e9b076630b3bcbfe92cac0c120af943 100644 (file)
@@ -434,6 +434,8 @@ run_dump_test "property-x86-shstk3a"
 run_dump_test "property-x86-shstk3b"
 run_dump_test "property-x86-shstk4"
 run_dump_test "property-x86-shstk5"
+run_dump_test "pie1"
+run_dump_test "pie1-nacl"
 
 if { !([istarget "i?86-*-linux*"]
        || [istarget "i?86-*-gnu*"]
diff --git a/ld/testsuite/ld-i386/pie1-nacl.d b/ld/testsuite/ld-i386/pie1-nacl.d
new file mode 100644 (file)
index 0000000..aafd6a7
--- /dev/null
@@ -0,0 +1,18 @@
+#source: pie1.s
+#as: --32
+#ld: -pie -melf_i386 -z relro
+#objdump: -dw --sym
+#target: i?86-*-nacl* x86_64-*-nacl*
+
+.*: +file format .*
+
+SYMBOL TABLE:
+#...
+10020000 l     O .got.plt      0+ _GLOBAL_OFFSET_TABLE_
+#...
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +0:   8d 80 00 00 fe ef       lea    -0x10020000\(%eax\),%eax
+#pass
diff --git a/ld/testsuite/ld-i386/pie1.d b/ld/testsuite/ld-i386/pie1.d
new file mode 100644 (file)
index 0000000..fb35342
--- /dev/null
@@ -0,0 +1,17 @@
+#as: --32
+#ld: -pie -melf_i386 -z relro
+#objdump: -dw --sym
+#notarget: i?86-*-nacl* x86_64-*-nacl*
+
+.*: +file format .*
+
+SYMBOL TABLE:
+#...
+0+2000 l     O .got.plt        0+ _GLOBAL_OFFSET_TABLE_
+#...
+
+Disassembly of section .text:
+
+0+129 <_start>:
+ +129: 8d 80 00 e0 ff ff       lea    -0x2000\(%eax\),%eax
+#pass
diff --git a/ld/testsuite/ld-i386/pie1.s b/ld/testsuite/ld-i386/pie1.s
new file mode 100644 (file)
index 0000000..b4d1d73
--- /dev/null
@@ -0,0 +1,5 @@
+       .text
+       .global _start
+       .weak foo
+_start:
+       leal    foo@GOTOFF(%eax), %eax