From: H.J. Lu Date: Wed, 11 Oct 2017 20:32:20 +0000 (-0700) Subject: x86: Run PR ld/19636 tests with -z dynamic-undefined-weak X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=853ee16fcdf7e60f297b3456353b3a69f4822bec;p=binutils-gdb.git 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. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index f43a0a16511..17192529fed 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,22 @@ +2017-10-11 H.J. Lu + + * 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 * emultempl/aarch64elf.em: Wrap einfo strings in _(). Formatting. diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index d79c4583e6c..07110152771 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -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 index 00000000000..0fb183d1b35 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1j.d @@ -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 index 00000000000..9f42699bb5a --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1k.d @@ -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 index 00000000000..c02908c1368 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-1l.d @@ -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 index 00000000000..c8c6ba43a35 --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3h.d @@ -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 index 00000000000..8169a596cbc --- /dev/null +++ b/ld/testsuite/ld-i386/pr19636-3i.d @@ -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 index 00000000000..3785cd6076b --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19636-1h.d @@ -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 index 00000000000..d8010ab17ad --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19636-1i.d @@ -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 index 00000000000..7ebf2cf1074 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19636-1j.d @@ -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 index 00000000000..88e62969460 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19636-2j.d @@ -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 index 00000000000..c8ea5c18c08 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19636-2k.d @@ -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 index 00000000000..60e5e2077aa --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19636-2l.d @@ -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 index 00000000000..ec0dbbfb617 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19636-2m.d @@ -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 ]+\.+ diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 676d44a3d0f..ef2cb1551cf 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -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"