aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-07-17 12:42:32 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-07-17 12:42:32 -0700
commit89d249d2f26884b5e62301541aa9ab43bcaecb67 (patch)
treea05a660f951dc3771f13c081be31b94685e1ecd0 /ld/testsuite/ld-i386
parent8e85f840e1870b17dce6a5bdb330c5bcd85a022a (diff)
i386: Add tests for PIE with undefined weak symbol
* 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.
Diffstat (limited to 'ld/testsuite/ld-i386')
-rw-r--r--ld/testsuite/ld-i386/i386.exp2
-rw-r--r--ld/testsuite/ld-i386/pie1-nacl.d18
-rw-r--r--ld/testsuite/ld-i386/pie1.d17
-rw-r--r--ld/testsuite/ld-i386/pie1.s5
4 files changed, 42 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 6c53046193..ba39fc132e 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -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
index 0000000000..aafd6a7ef5
--- /dev/null
+++ b/ld/testsuite/ld-i386/pie1-nacl.d
@@ -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
index 0000000000..fb35342321
--- /dev/null
+++ b/ld/testsuite/ld-i386/pie1.d
@@ -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
index 0000000000..b4d1d73d6b
--- /dev/null
+++ b/ld/testsuite/ld-i386/pie1.s
@@ -0,0 +1,5 @@
+ .text
+ .global _start
+ .weak foo
+_start:
+ leal foo@GOTOFF(%eax), %eax