diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 14 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/i386.exp | 21 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/plt-pic2.dd | 33 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/plt2.dd | 35 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/plt2.rd | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/plt2.s | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pr20830.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-16-i386-now.d | 14 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-2-i386-now.d | 36 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d | 36 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/pr17154-i386-now.d | 52 |
11 files changed, 259 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index cd85a35..c56b3db 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,17 @@ +2017-05-08 H.J. Lu <hongjiu.lu@intel.com> + + * testsuite/ld-i386/i386.exp: Add some -z now tests. + * testsuite/ld-i386/plt-pic2.dd: New file. + * testsuite/ld-i386/plt2.dd: Likewise. + * testsuite/ld-i386/plt2.rd: Likewise. + * testsuite/ld-i386/plt2.s: Likewise. + * testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise. + * testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise. + * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise. + * testsuite/ld-ifunc/pr17154-i386-now.d: Likewise. + * testsuite/ld-i386/pr20830.d: Update the .plt.got section + with func@plt. + 2017-05-08 Thomas Preud'homme <thomas.preudhomme@arm.com> * testsuite/ld-arm/arm-elf.exp diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index a709bcf..5cb741f 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -1160,6 +1160,27 @@ if { !([istarget "i?86-*-linux*"] return } +run_ld_link_tests [list \ + [list \ + "basic PLT generation (non-PIC, -z now)" \ + "-z now -melf_i386 tmpdir/libpltlib.so" \ + "" \ + "--32" \ + {plt2.s} \ + {{readelf -SW plt2.rd} {objdump -dwr plt2.dd}} \ + "plt2" \ + ] \ + [list \ + "basic PLT generation (PIC, -z now)" \ + "-z now -shared -melf_i386 tmpdir/libpltlib.so" \ + "" \ + "--32" \ + {plt-pic.s} \ + {{objdump -dwr plt-pic2.dd}} \ + "plt-pic2.so" \ + ] \ +] + # Linux only tests run_dump_test "pltgot-1" run_dump_test "pltgot-2" diff --git a/ld/testsuite/ld-i386/plt-pic2.dd b/ld/testsuite/ld-i386/plt-pic2.dd new file mode 100644 index 0000000..aa311fe --- /dev/null +++ b/ld/testsuite/ld-i386/plt-pic2.dd @@ -0,0 +1,33 @@ +#source: plt-pic.s +#as: --32 +#ld: -z now -shared -melf_i386 +#objdump: -dwr +#target: i?86-*-* + +.*: +file format .* + + +Disassembly of section .plt: + +0+180 <.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\) + ... + +Disassembly of section .plt.got: + +0+190 <fn1@plt>: + +[a-f0-9]+: ff a3 f8 ff ff ff jmp \*-0x8\(%ebx\) + +[a-f0-9]+: 66 90 xchg %ax,%ax + +0+198 <fn2@plt>: + +[a-f0-9]+: ff a3 fc ff ff ff jmp \*-0x4\(%ebx\) + +[a-f0-9]+: 66 90 xchg %ax,%ax + +Disassembly of section .text: + +0+1a0 <foo>: + +[a-f0-9]+: e8 eb ff ff ff call 190 <fn1@plt> + +[a-f0-9]+: e9 ee ff ff ff jmp 198 <fn2@plt> +#pass diff --git a/ld/testsuite/ld-i386/plt2.dd b/ld/testsuite/ld-i386/plt2.dd new file mode 100644 index 0000000..1a5ea6f --- /dev/null +++ b/ld/testsuite/ld-i386/plt2.dd @@ -0,0 +1,35 @@ +#source: plt2.s +#as: --32 +#ld: -z now -melf_i386 +#objdump: -dwr +#target: i?86-*-* + +.*: +file format .* + + +Disassembly of section .plt: + +0+80481c0 <.plt>: + +[a-f0-9]+: ff 35 b4 92 04 08 pushl 0x80492b4 + +[a-f0-9]+: ff 25 b8 92 04 08 jmp \*0x80492b8 + +[a-f0-9]+: 00 00 add %al,\(%eax\) + ... + +0+80481d0 <fn1@plt>: + +[a-f0-9]+: ff 25 bc 92 04 08 jmp \*0x80492bc + +[a-f0-9]+: 68 00 00 00 00 push \$0x0 + +[a-f0-9]+: e9 e0 ff ff ff jmp 80481c0 <.plt> + +Disassembly of section .plt.got: + +0+80481e0 <fn2@plt>: + +[a-f0-9]+: ff 25 ac 92 04 08 jmp \*0x80492ac + +[a-f0-9]+: 66 90 xchg %ax,%ax + +Disassembly of section .text: + +0+80481e8 <_start>: + +[a-f0-9]+: e8 e3 ff ff ff call 80481d0 <fn1@plt> + +[a-f0-9]+: e8 ee ff ff ff call 80481e0 <fn2@plt> + +[a-f0-9]+: 81 7c 24 04 d0 81 04 08 cmpl \$0x80481d0,0x4\(%esp\) +#pass diff --git a/ld/testsuite/ld-i386/plt2.rd b/ld/testsuite/ld-i386/plt2.rd new file mode 100644 index 0000000..11952b4 --- /dev/null +++ b/ld/testsuite/ld-i386/plt2.rd @@ -0,0 +1,9 @@ +#source: plt2.s +#as: --32 +#ld: -z now -melf_i386 +#readelf: -SW +#target: i?86-*-* + +#... + +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+20 +.* +AX +0 +0 +16 +#pass diff --git a/ld/testsuite/ld-i386/plt2.s b/ld/testsuite/ld-i386/plt2.s new file mode 100644 index 0000000..d902bac --- /dev/null +++ b/ld/testsuite/ld-i386/plt2.s @@ -0,0 +1,7 @@ + .text + .globl _start + .type _start,@function +_start: + call fn1 + call fn2 + cmpl $fn1, 4(%esp) diff --git a/ld/testsuite/ld-i386/pr20830.d b/ld/testsuite/ld-i386/pr20830.d index caaadd7..55fe924 100644 --- a/ld/testsuite/ld-i386/pr20830.d +++ b/ld/testsuite/ld-i386/pr20830.d @@ -48,13 +48,13 @@ Disassembly of section .plt: Disassembly of section .plt.got: -0+180 <.plt.got>: +0+180 <func@plt>: +[a-f0-9]+: ff a3 fc ff ff ff jmp \*-0x4\(%ebx\) +[a-f0-9]+: 66 90 xchg %ax,%ax Disassembly of section .text: 0+188 <foo>: - +[a-f0-9]+: e8 f3 ff ff ff call 180 <.plt.got> + +[a-f0-9]+: e8 f3 ff ff ff call 180 <func@plt> +[a-f0-9]+: 8b 83 fc ff ff ff mov -0x4\(%ebx\),%eax #pass diff --git a/ld/testsuite/ld-ifunc/ifunc-16-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-16-i386-now.d new file mode 100644 index 0000000..088b1f3 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-16-i386-now.d @@ -0,0 +1,14 @@ +#source: ifunc-16-x86.s +#ld: -z now -shared -m elf_i386 +#as: --32 +#readelf: -r --wide +#target: x86_64-*-* i?86-*-* +#notarget: x86_64-*-nacl* i?86-*-nacl* + +Relocation section '.rel.dyn' at .* +[ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_GLOB_DAT[ ]+0+[ ]+ifunc + +Relocation section '.rel.plt' at .* +[ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_IRELATIVE[ ]* diff --git a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d new file mode 100644 index 0000000..ebe7ded --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d @@ -0,0 +1,36 @@ +#source: ifunc-2-i386.s +#ld: -z now -m elf_i386 -shared +#as: --32 +#objdump: -dw +#target: x86_64-*-* i?86-*-* +#notarget: x86_64-*-nacl* i?86-*-nacl* + +.*: +file format .* + + +Disassembly of section .plt: + +0+150 <.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\) + ... + +0+160 <\*ABS\*@plt>: + +[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 e0 ff ff ff jmp 150 <.plt> + +Disassembly of section .text: + +0+170 <foo>: + +[a-f0-9]+: c3 ret + +0+171 <bar>: + +[a-f0-9]+: e8 00 00 00 00 call 176 <bar\+0x5> + +[a-f0-9]+: 5b pop %ebx + +[a-f0-9]+: 81 c3 9e 10 00 00 add \$0x109e,%ebx + +[a-f0-9]+: e8 de ff ff ff call 160 <\*ABS\*@plt> + +[a-f0-9]+: 8d 83 4c ef ff ff lea -0x10b4\(%ebx\),%eax + +[a-f0-9]+: c3 ret +#pass diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d new file mode 100644 index 0000000..7cb2e54 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d @@ -0,0 +1,36 @@ +#source: ifunc-2-local-i386.s +#ld: -z now -m elf_i386 -shared +#as: --32 +#objdump: -dw +#target: x86_64-*-* i?86-*-* +#notarget: x86_64-*-nacl* i?86-*-nacl* + +.*: +file format .* + + +Disassembly of section .plt: + +0+140 <.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\) + ... + +0+150 <\*ABS\*@plt>: + +[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 e0 ff ff ff jmp 140 <.plt> + +Disassembly of section .text: + +0+160 <__GI_foo>: + +[a-f0-9]+: c3 ret + +0+161 <bar>: + +[a-f0-9]+: e8 00 00 00 00 call 166 <bar\+0x5> + +[a-f0-9]+: 5b pop %ebx + +[a-f0-9]+: 81 c3 9e 10 00 00 add \$0x109e,%ebx + +[a-f0-9]+: e8 de ff ff ff call 150 <\*ABS\*@plt> + +[a-f0-9]+: 8d 83 4c ef ff ff lea -0x10b4\(%ebx\),%eax + +[a-f0-9]+: c3 ret +#pass diff --git a/ld/testsuite/ld-ifunc/pr17154-i386-now.d b/ld/testsuite/ld-ifunc/pr17154-i386-now.d new file mode 100644 index 0000000..006af67 --- /dev/null +++ b/ld/testsuite/ld-ifunc/pr17154-i386-now.d @@ -0,0 +1,52 @@ +#source: pr17154-x86.s +#ld: -z now -m elf_i386 -shared +#as: --32 +#objdump: -dw +#target: x86_64-*-* i?86-*-* +#notarget: x86_64-*-nacl* i?86-*-nacl* + +.*: +file format .* + + +Disassembly of section .plt: + +0+1d0 <.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\) + ... + +0+1e0 <\*ABS\*@plt>: + +[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\) + +[a-f0-9]+: 68 08 00 00 00 push \$0x8 + +[a-f0-9]+: e9 e0 ff ff ff jmp 1d0 <.plt> + +0+1f0 <\*ABS\*@plt>: + +[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\) + +[a-f0-9]+: 68 00 00 00 00 push \$0x0 + +[a-f0-9]+: e9 d0 ff ff ff jmp 1d0 <.plt> + +Disassembly of section .plt.got: + +0+200 <func1@plt>: + +[a-f0-9]+: ff a3 f8 ff ff ff jmp \*-0x8\(%ebx\) + +[a-f0-9]+: 66 90 xchg %ax,%ax + +0+208 <func2@plt>: + +[a-f0-9]+: ff a3 fc ff ff ff jmp \*-0x4\(%ebx\) + +[a-f0-9]+: 66 90 xchg %ax,%ax + +Disassembly of section .text: + +0+210 <resolve1>: + +[a-f0-9]+: e8 eb ff ff ff call 200 <func1@plt> + +0+215 <g1>: + +[a-f0-9]+: e9 d6 ff ff ff jmp 1f0 <\*ABS\*@plt> + +0+21a <resolve2>: + +[a-f0-9]+: e8 e9 ff ff ff call 208 <func2@plt> + +0+21f <g2>: + +[a-f0-9]+: e9 bc ff ff ff jmp 1e0 <\*ABS\*@plt> +#pass |