x86: Run PR ld/19636 tests with -z dynamic-undefined-weak

"-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.
This commit is contained in:
H.J. Lu 2017-10-11 13:32:20 -07:00
parent 4f9d99066e
commit 853ee16fcd
15 changed files with 190 additions and 0 deletions

View 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.

View 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"

View File

@ -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 ]+ .\.+

View File

@ -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 ]+ .\.+

View File

@ -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>

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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 ]+\.+

View File

@ -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 ]+\.+

View File

@ -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

View File

@ -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 ]+\.+

View 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"