x86: Run PR ld/19636 tests with -z dynamic-undefined-weak
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 11 Oct 2017 20:32:20 +0000 (13:32 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 11 Oct 2017 20:36:19 +0000 (13:36 -0700)
"-z dynamic-undefined-weak" makes undefined weak symbols dynamic, but
undefined weak symbols are still resolved to 0 at link-time if there
is no dynamic linker in executable.

* testsuite/ld-i386/i386.exp: Run pr19636-1j, pr19636-1k,
pr19636-1l, pr19636-3h and pr19636-3i.
* testsuite/ld-i386/pr19636-1j.d: New file.
* testsuite/ld-i386/pr19636-1k.d: Likewise.
* testsuite/ld-i386/pr19636-1l.d: Likewise.
* testsuite/ld-i386/pr19636-3h.d: Likewise.
* testsuite/ld-i386/pr19636-3i.d: Likewise.
* testsuite/ld-x86-64/pr19636-1h.d: Likewise.
* testsuite/ld-x86-64/pr19636-1i.d: Likewise.
* testsuite/ld-x86-64/pr19636-1j.d: Likewise.
* testsuite/ld-x86-64/pr19636-2j.d: Likewise.
* testsuite/ld-x86-64/pr19636-2k.d: Likewise.
* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
* testsuite/ld-x86-64/pr19636-2m.d: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr19636-1h, pr19636-1i,
pr19636-1j, pr19636-2j, pr19636-2k, pr19636-2l and pr19636-2m.

15 files changed:
ld/ChangeLog
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/pr19636-1j.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19636-1k.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19636-1l.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19636-3h.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19636-3i.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19636-1h.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19636-1i.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19636-1j.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19636-2j.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19636-2k.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19636-2l.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19636-2m.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp

index f43a0a1..1719252 100644 (file)
@@ -1,3 +1,22 @@
+2017-10-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * testsuite/ld-i386/i386.exp: Run pr19636-1j, pr19636-1k,
+       pr19636-1l, pr19636-3h and pr19636-3i.
+       * testsuite/ld-i386/pr19636-1j.d: New file.
+       * testsuite/ld-i386/pr19636-1k.d: Likewise.
+       * testsuite/ld-i386/pr19636-1l.d: Likewise.
+       * testsuite/ld-i386/pr19636-3h.d: Likewise.
+       * testsuite/ld-i386/pr19636-3i.d: Likewise.
+       * testsuite/ld-x86-64/pr19636-1h.d: Likewise.
+       * testsuite/ld-x86-64/pr19636-1i.d: Likewise.
+       * testsuite/ld-x86-64/pr19636-1j.d: Likewise.
+       * testsuite/ld-x86-64/pr19636-2j.d: Likewise.
+       * testsuite/ld-x86-64/pr19636-2k.d: Likewise.
+       * testsuite/ld-x86-64/pr19636-2l.d: Likewise.
+       * testsuite/ld-x86-64/pr19636-2m.d: Likewise.
+       * testsuite/ld-x86-64/x86-64.exp: Run pr19636-1h, pr19636-1i,
+       pr19636-1j, pr19636-2j, pr19636-2k, pr19636-2l and pr19636-2m.
+
 2017-10-11  Alan Modra  <amodra@gmail.com>
 
        * emultempl/aarch64elf.em: Wrap einfo strings in _().  Formatting.
index d79c458..0711015 100644 (file)
@@ -367,6 +367,9 @@ run_dump_test "pr19636-1f"
 run_dump_test "pr19636-1g"
 run_dump_test "pr19636-1h"
 run_dump_test "pr19636-1i"
+run_dump_test "pr19636-1j"
+run_dump_test "pr19636-1k"
+run_dump_test "pr19636-1l"
 run_dump_test "pr19636-2a"
 run_dump_test "pr19636-2b"
 run_dump_test "pr19636-2c"
@@ -382,6 +385,8 @@ run_dump_test "pr19636-3d"
 run_dump_test "pr19636-3e"
 run_dump_test "pr19636-3f"
 run_dump_test "pr19636-3g"
+run_dump_test "pr19636-3h"
+run_dump_test "pr19636-3i"
 run_dump_test "pr19636-4a"
 run_dump_test "pr19636-4b"
 run_dump_test "pr19636-4c"
diff --git a/ld/testsuite/ld-i386/pr19636-1j.d b/ld/testsuite/ld-i386/pr19636-1j.d
new file mode 100644 (file)
index 0000000..0fb183d
--- /dev/null
@@ -0,0 +1,12 @@
+#source: pr19636-1.s
+#as: --32 -mrelax-relocations=no
+#ld: -pie -m elf_i386 --no-dynamic-linker -z dynamic-undefined-weak
+#readelf : -r --wide -x .got -x .got.plt
+
+There are no relocations in this file.
+
+Hex dump of section '.got':
+  0x[0-9a-f]+ [0 ]+\.+
+
+Hex dump of section '.got.plt':
+  0x[0-9a-f]+ +[0-9a-f]+ +[0 ]+ .\.+
diff --git a/ld/testsuite/ld-i386/pr19636-1k.d b/ld/testsuite/ld-i386/pr19636-1k.d
new file mode 100644 (file)
index 0000000..9f42699
--- /dev/null
@@ -0,0 +1,19 @@
+#source: pr19636-1.s
+#as: --32 -mrelax-relocations=no
+#ld: -pie -E -m elf_i386 --no-dynamic-linker -z dynamic-undefined-weak
+#readelf : -r --wide -x .got -x .got.plt --dyn-syms
+
+There are no relocations in this file.
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_start
+#...
+
+Hex dump of section '.got':
+  0x[0-9a-f]+ [0 ]+\.+
+
+Hex dump of section '.got.plt':
+  0x[0-9a-f]+ +[0-9a-f]+ +[0 ]+ .\.+
diff --git a/ld/testsuite/ld-i386/pr19636-1l.d b/ld/testsuite/ld-i386/pr19636-1l.d
new file mode 100644 (file)
index 0000000..c02908c
--- /dev/null
@@ -0,0 +1,26 @@
+#source: pr19636-1.s
+#as: --32 -mrelax-relocations=no
+#ld: -pie -m elf_i386 --no-dynamic-linker -z dynamic-undefined-weak
+#objdump: -dw
+#notarget: i?86-*-nacl* x86_64-*-nacl*
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+.* <.plt>:
+[      ]*[a-f0-9]+:    ff b3 04 00 00 00       pushl  0x4\(%ebx\)
+[      ]*[a-f0-9]+:    ff a3 08 00 00 00       jmp    \*0x8\(%ebx\)
+[      ]*[a-f0-9]+:    00 00                   add    %al,\(%eax\)
+[      ]*[a-f0-9]+:    00 00                   add    %al,\(%eax\)
+[      ]*[a-f0-9]+:    ff a3 0c 00 00 00       jmp    \*0xc\(%ebx\)
+[      ]*[a-f0-9]+:    68 00 00 00 00          push   \$0x0
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmp    [a-f0-9]+ <.*>
+
+Disassembly of section .text:
+
+.* <_start>:
+[      ]*[a-f0-9]+:    3b 80 f8 ff ff ff       cmp    -0x8\(%eax\),%eax
+[      ]*[a-f0-9]+:    ff a0 fc ff ff ff       jmp    \*-0x4\(%eax\)
+[      ]*[a-f0-9]+:    e8 df ff ff ff          call   .* <\.plt\+0x10>
diff --git a/ld/testsuite/ld-i386/pr19636-3h.d b/ld/testsuite/ld-i386/pr19636-3h.d
new file mode 100644 (file)
index 0000000..c8c6ba4
--- /dev/null
@@ -0,0 +1,6 @@
+#source: pr19636-3.s
+#as: --32
+#ld: -pie -m elf_i386 -z dynamic-undefined-weak
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-i386/pr19636-3i.d b/ld/testsuite/ld-i386/pr19636-3i.d
new file mode 100644 (file)
index 0000000..8169a59
--- /dev/null
@@ -0,0 +1,6 @@
+#source: pr19636-3.s
+#as: --32
+#ld: -pie -E -m elf_i386 -z dynamic-undefined-weak
+#readelf : -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19636-1h.d b/ld/testsuite/ld-x86-64/pr19636-1h.d
new file mode 100644 (file)
index 0000000..3785cd6
--- /dev/null
@@ -0,0 +1,6 @@
+#source: pr19636-1.s
+#as: --64
+#ld: -pie -m elf_x86_64 -z dynamic-undefined-weak
+#readelf : -r
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19636-1i.d b/ld/testsuite/ld-x86-64/pr19636-1i.d
new file mode 100644 (file)
index 0000000..d8010ab
--- /dev/null
@@ -0,0 +1,6 @@
+#source: pr19636-1.s
+#as: --64
+#ld: -pie -E -m elf_x86_64 -z dynamic-undefined-weak
+#readelf : -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19636-1j.d b/ld/testsuite/ld-x86-64/pr19636-1j.d
new file mode 100644 (file)
index 0000000..7ebf2cf
--- /dev/null
@@ -0,0 +1,6 @@
+#source: pr19636-1.s
+#as: --64
+#ld: -E -m elf_x86_64 -z dynamic-undefined-weak
+#readelf : -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19636-2j.d b/ld/testsuite/ld-x86-64/pr19636-2j.d
new file mode 100644 (file)
index 0000000..88e6296
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19636-2.s
+#as: --64 -mrelax-relocations=no
+#ld: -pie -m elf_x86_64 --no-dynamic-linker -z dynamic-undefined-weak
+#readelf : -r --wide -x .got -x .got.plt
+
+There are no relocations in this file.
+
+Hex dump of section '.got':
+  0x[0-9a-f]+ [0 ]+\.+
+
+Hex dump of section '.got.plt':
+  0x[0-9a-f]+ +[0-9a-f]+ +[0 ]+ .+
+  0x[0-9a-f]+ [0 ]+\.+
diff --git a/ld/testsuite/ld-x86-64/pr19636-2k.d b/ld/testsuite/ld-x86-64/pr19636-2k.d
new file mode 100644 (file)
index 0000000..c8ea5c1
--- /dev/null
@@ -0,0 +1,20 @@
+#source: pr19636-2.s
+#as: --64 -mrelax-relocations=no
+#ld: -pie -E -m elf_x86_64 --no-dynamic-linker -z dynamic-undefined-weak
+#readelf : -r --wide -x .got -x .got.plt --dyn-syms
+
+There are no relocations in this file.
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_start
+#...
+
+Hex dump of section '.got':
+  0x[0-9a-f]+ [0 ]+\.+
+
+Hex dump of section '.got.plt':
+  0x[0-9a-f]+ +[0-9a-f]+ +[0 ]+ .+
+  0x[0-9a-f]+ [0 ]+\.+
diff --git a/ld/testsuite/ld-x86-64/pr19636-2l.d b/ld/testsuite/ld-x86-64/pr19636-2l.d
new file mode 100644 (file)
index 0000000..60e5e20
--- /dev/null
@@ -0,0 +1,26 @@
+#source: pr19636-2.s
+#as: --64 -mrelax-relocations=no
+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak
+#objdump: -dw
+#notarget: x86_64-*-nacl*
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+190 <.plt>:
+ +[a-f0-9]+:   ff 35 2a 01 20 00       pushq  0x20012a\(%rip\)        # 2002c0 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+:   ff 25 2c 01 20 00       jmpq   \*0x20012c\(%rip\)        # 2002c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+:   0f 1f 40 00             nopl   0x0\(%rax\)
+ +[a-f0-9]+:   ff 25 2a 01 20 00       jmpq   \*0x20012a\(%rip\)        # 2002d0 <_GLOBAL_OFFSET_TABLE_\+0x18>
+ +[a-f0-9]+:   68 00 00 00 00          pushq  \$0x0
+ +[a-f0-9]+:   e9 00 00 00 00          jmpq   1b0 <_start>
+
+Disassembly of section .text:
+
+0+1b0 <_start>:
+ +[a-f0-9]+:   48 3b 05 f1 00 20 00    cmp    0x2000f1\(%rip\),%rax        # 2002a8 <.got>
+ +[a-f0-9]+:   ff 25 f3 00 20 00       jmpq   \*0x2000f3\(%rip\)        # 2002b0 <.got\+0x8>
+ +[a-f0-9]+:   e8 de ff ff ff          callq  1a0 <.plt\+0x10>
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19636-2m.d b/ld/testsuite/ld-x86-64/pr19636-2m.d
new file mode 100644 (file)
index 0000000..ec0dbbf
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19636-2.s
+#as: --64 -mrelax-relocations=no
+#ld: -m elf_x86_64 --no-dynamic-linker -z dynamic-undefined-weak
+#readelf : -r --wide -x .got -x .got.plt --dyn-syms
+
+There are no relocations in this file.
+
+Hex dump of section '.got':
+  0x[0-9a-f]+ [0 ]+\.+
+
+Hex dump of section '.got.plt':
+  0x[0-9a-f]+ [0 ]+\.+
+  0x[0-9a-f]+ [0 ]+\.+
index 676d44a..ef2cb15 100644 (file)
@@ -504,6 +504,9 @@ run_dump_test "pr19636-1d"
 run_dump_test "pr19636-1e"
 run_dump_test "pr19636-1f"
 run_dump_test "pr19636-1g"
+run_dump_test "pr19636-1h"
+run_dump_test "pr19636-1i"
+run_dump_test "pr19636-1j"
 run_dump_test "pr19636-2a"
 run_dump_test "pr19636-2b"
 run_dump_test "pr19636-2c"
@@ -514,6 +517,10 @@ run_dump_test "pr19636-2f"
 run_dump_test "pr19636-2g"
 run_dump_test "pr19636-2h"
 run_dump_test "pr19636-2i"
+run_dump_test "pr19636-2j"
+run_dump_test "pr19636-2k"
+run_dump_test "pr19636-2l"
+run_dump_test "pr19636-2m"
 run_dump_test "pr19636-3a"
 run_dump_test "pr19636-3b"
 run_dump_test "pr19636-3c"