From: H.J. Lu Date: Wed, 15 Jun 2016 16:44:21 +0000 (-0700) Subject: X86: Add tests for static function pointer X-Git-Tag: binutils-2_27~226 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a4b0e0f9670679f8942f2bd57aa86ae0412b171;p=external%2Fbinutils.git X86: Add tests for static function pointer * testsuite/ld-i386/no-plt-check1a.S (check): Test static function pointer. * testsuite/ld-i386/no-plt-check1b.S (check): Likewise. * testsuite/ld-x86-64/no-plt-check1.S (check): Likewise. * testsuite/ld-i386/no-plt-extern1a.S (func_p): New. Static function pointer. * testsuite/ld-i386/no-plt-extern1b.S (func_p): Likewise. * testsuite/ld-x86-64/no-plt-extern1.S (func_p): Likewise. * testsuite/ld-i386/no-plt-1a.dd: Updated. * testsuite/ld-i386/no-plt-1b.dd: Likewise. * testsuite/ld-i386/no-plt-1c.dd: Likewise. * testsuite/ld-i386/no-plt-1d.dd: Likewise. * testsuite/ld-i386/no-plt-1e.dd: Likewise. * testsuite/ld-i386/no-plt-1f.dd: Likewise. * testsuite/ld-i386/no-plt-1g.dd: Likewise. * testsuite/ld-i386/no-plt-1h.dd: Likewise. * testsuite/ld-i386/no-plt-1i.dd: Likewise. * testsuite/ld-i386/no-plt-1j.dd: Likewise. * testsuite/ld-x86-64/no-plt-1a.dd: Likewise. * testsuite/ld-x86-64/no-plt-1b.dd: Likewise. * testsuite/ld-x86-64/no-plt-1c.dd: Likewise. * testsuite/ld-x86-64/no-plt-1d.dd: Likewise. * testsuite/ld-x86-64/no-plt-1e.dd: Likewise. * testsuite/ld-x86-64/no-plt-1f.dd: Likewise. * testsuite/ld-x86-64/no-plt-1g.dd: Likewise. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 516b4bb..0da9a92 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,31 @@ +2016-06-15 H.J. Lu + + * testsuite/ld-i386/no-plt-check1a.S (check): Test static + function pointer. + * testsuite/ld-i386/no-plt-check1b.S (check): Likewise. + * testsuite/ld-x86-64/no-plt-check1.S (check): Likewise. + * testsuite/ld-i386/no-plt-extern1a.S (func_p): New. Static + function pointer. + * testsuite/ld-i386/no-plt-extern1b.S (func_p): Likewise. + * testsuite/ld-x86-64/no-plt-extern1.S (func_p): Likewise. + * testsuite/ld-i386/no-plt-1a.dd: Updated. + * testsuite/ld-i386/no-plt-1b.dd: Likewise. + * testsuite/ld-i386/no-plt-1c.dd: Likewise. + * testsuite/ld-i386/no-plt-1d.dd: Likewise. + * testsuite/ld-i386/no-plt-1e.dd: Likewise. + * testsuite/ld-i386/no-plt-1f.dd: Likewise. + * testsuite/ld-i386/no-plt-1g.dd: Likewise. + * testsuite/ld-i386/no-plt-1h.dd: Likewise. + * testsuite/ld-i386/no-plt-1i.dd: Likewise. + * testsuite/ld-i386/no-plt-1j.dd: Likewise. + * testsuite/ld-x86-64/no-plt-1a.dd: Likewise. + * testsuite/ld-x86-64/no-plt-1b.dd: Likewise. + * testsuite/ld-x86-64/no-plt-1c.dd: Likewise. + * testsuite/ld-x86-64/no-plt-1d.dd: Likewise. + * testsuite/ld-x86-64/no-plt-1e.dd: Likewise. + * testsuite/ld-x86-64/no-plt-1f.dd: Likewise. + * testsuite/ld-x86-64/no-plt-1g.dd: Likewise. + 2016-06-14 Senthil Kumar Selvaraj PR ld/20254 diff --git a/ld/testsuite/ld-i386/no-plt-1a.dd b/ld/testsuite/ld-i386/no-plt-1a.dd index 8fcf9cf..e5bd9bd 100644 --- a/ld/testsuite/ld-i386/no-plt-1a.dd +++ b/ld/testsuite/ld-i386/no-plt-1a.dd @@ -13,6 +13,9 @@ Disassembly of section .text: +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp +\$0x[0-9a-f]+,%eax + +[a-f0-9]+: 75 39 jne [0-9a-f]+ + +[a-f0-9]+: c7 c2 ([0-9a-f]{2} ){4}[ ]+mov +\$0x[a-f0-9]+,%edx + +[a-f0-9]+: 39 02 cmp %eax,\(%edx\) +[a-f0-9]+: 75 2f jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-1b.dd b/ld/testsuite/ld-i386/no-plt-1b.dd index 5af3471..2d35336 100644 --- a/ld/testsuite/ld-i386/no-plt-1b.dd +++ b/ld/testsuite/ld-i386/no-plt-1b.dd @@ -13,6 +13,9 @@ Disassembly of section .text: +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\) +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax + +[a-f0-9]+: 75 39 jne [0-9a-f]+ + +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx + +[a-f0-9]+: 39 02 cmp %eax,\(%edx\) +[a-f0-9]+: 75 2f jne [0-9a-f]+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\) +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-1c.dd b/ld/testsuite/ld-i386/no-plt-1c.dd index ebfc403..cc5fc17 100644 --- a/ld/testsuite/ld-i386/no-plt-1c.dd +++ b/ld/testsuite/ld-i386/no-plt-1c.dd @@ -13,6 +13,9 @@ Disassembly of section .text: +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\) +[a-f0-9]+: 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp +\$0x[0-9a-f]+,%eax + +[a-f0-9]+: 75 39 jne [0-9a-f]+ + +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx + +[a-f0-9]+: 39 02 cmp %eax,\(%edx\) +[a-f0-9]+: 75 2f jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-1d.dd b/ld/testsuite/ld-i386/no-plt-1d.dd index 246b252..396dbf3 100644 --- a/ld/testsuite/ld-i386/no-plt-1d.dd +++ b/ld/testsuite/ld-i386/no-plt-1d.dd @@ -13,6 +13,9 @@ Disassembly of section .text: +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp +\$0x[0-9a-f]+,%eax + +[a-f0-9]+: 75 39 jne [0-9a-f]+ + +[a-f0-9]+: c7 c2 ([0-9a-f]{2} ){4}[ ]+mov +\$0x[a-f0-9]+,%edx + +[a-f0-9]+: 39 02 cmp %eax,\(%edx\) +[a-f0-9]+: 75 2f jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-1e.dd b/ld/testsuite/ld-i386/no-plt-1e.dd index 2787dae..6f27199 100644 --- a/ld/testsuite/ld-i386/no-plt-1e.dd +++ b/ld/testsuite/ld-i386/no-plt-1e.dd @@ -13,6 +13,9 @@ Disassembly of section .text: +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax + +[a-f0-9]+: 75 39 jne [0-9a-f]+ + +[a-f0-9]+: 8d 93 ([0-9a-f]{2} ){4}[ ]+lea +0x[a-f0-9]+\(%ebx\),%edx + +[a-f0-9]+: 39 02 cmp %eax,\(%edx\) +[a-f0-9]+: 75 2f jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-1f.dd b/ld/testsuite/ld-i386/no-plt-1f.dd index 5af3471..2d35336 100644 --- a/ld/testsuite/ld-i386/no-plt-1f.dd +++ b/ld/testsuite/ld-i386/no-plt-1f.dd @@ -13,6 +13,9 @@ Disassembly of section .text: +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\) +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax + +[a-f0-9]+: 75 39 jne [0-9a-f]+ + +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx + +[a-f0-9]+: 39 02 cmp %eax,\(%edx\) +[a-f0-9]+: 75 2f jne [0-9a-f]+ +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\) +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-1g.dd b/ld/testsuite/ld-i386/no-plt-1g.dd index 546c16d..f9464e7 100644 --- a/ld/testsuite/ld-i386/no-plt-1g.dd +++ b/ld/testsuite/ld-i386/no-plt-1g.dd @@ -13,6 +13,9 @@ Disassembly of section .text: +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\) +[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax + +[a-f0-9]+: 75 39 jne [0-9a-f]+ + +[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx + +[a-f0-9]+: 39 02 cmp %eax,\(%edx\) +[a-f0-9]+: 75 2f jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-1h.dd b/ld/testsuite/ld-i386/no-plt-1h.dd index 9d07d39..0d662c9 100644 --- a/ld/testsuite/ld-i386/no-plt-1h.dd +++ b/ld/testsuite/ld-i386/no-plt-1h.dd @@ -9,7 +9,10 @@ Disassembly of section .text: [0-9a-f]+ : +[a-f0-9]+: 83 ec 0c sub \$0xc,%esp +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ - +[a-f0-9]+: 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp +\$0x[0-9a-f]+,%eax + +[a-f0-9]+: c7 c2 ([0-9a-f]{2} ){4}[ ]+mov +\$0x[a-f0-9]+,%edx + +[a-f0-9]+: 39 d0 cmp %edx,%eax + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 39 15 ([0-9a-f]{2} ){4}[ ]+cmp +%edx,0x[0-9a-f]+ +[a-f0-9]+: 75 2c jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-1i.dd b/ld/testsuite/ld-i386/no-plt-1i.dd index d6f93b7..05e2d6d 100644 --- a/ld/testsuite/ld-i386/no-plt-1i.dd +++ b/ld/testsuite/ld-i386/no-plt-1i.dd @@ -9,7 +9,10 @@ Disassembly of section .text: [0-9a-f]+ : +[a-f0-9]+: 83 ec 0c sub \$0xc,%esp +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ - +[a-f0-9]+: 3b 05 ([0-9a-f]{2} ){4}[ ]+cmp +0x[0-9a-f]+,%eax + +[a-f0-9]+: 8b 15 ([0-9a-f]{2} ){4}[ ]+mov +0x[a-f0-9]+,%edx + +[a-f0-9]+: 39 d0 cmp %edx,%eax + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 39 15 ([0-9a-f]{2} ){4}[ ]+cmp +%edx,0x[0-9a-f]+ +[a-f0-9]+: 75 2c jne [0-9a-f]+ +[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+call +\*0x[0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-1j.dd b/ld/testsuite/ld-i386/no-plt-1j.dd index 50fd693..258b0a0 100644 --- a/ld/testsuite/ld-i386/no-plt-1j.dd +++ b/ld/testsuite/ld-i386/no-plt-1j.dd @@ -9,7 +9,10 @@ Disassembly of section .text: [0-9a-f]+ : +[a-f0-9]+: 83 ec 0c sub \$0xc,%esp +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ - +[a-f0-9]+: 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp +\$0x[0-9a-f]+,%eax + +[a-f0-9]+: c7 c2 ([0-9a-f]{2} ){4}[ ]+mov +\$0x[a-f0-9]+,%edx + +[a-f0-9]+: 39 d0 cmp %edx,%eax + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 39 15 ([0-9a-f]{2} ){4}[ ]+cmp +%edx,0x[0-9a-f]+ +[a-f0-9]+: 75 2c jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-i386/no-plt-check1a.S b/ld/testsuite/ld-i386/no-plt-check1a.S index 1699dbe..82d186b 100644 --- a/ld/testsuite/ld-i386/no-plt-check1a.S +++ b/ld/testsuite/ld-i386/no-plt-check1a.S @@ -13,6 +13,9 @@ check: call *get_func@GOT(%ebx) cmpl func@GOT(%ebx), %eax jne .L3 + movl func_p@GOT(%ebx), %edx + cmpl %eax, (%edx) + jne .L3 call *func@GOT(%ebx) cmpl $305419896, %eax jne .L3 diff --git a/ld/testsuite/ld-i386/no-plt-check1b.S b/ld/testsuite/ld-i386/no-plt-check1b.S index d27ab83..aeee940 100644 --- a/ld/testsuite/ld-i386/no-plt-check1b.S +++ b/ld/testsuite/ld-i386/no-plt-check1b.S @@ -8,7 +8,10 @@ check: subl $12, %esp call *get_func@GOT - cmpl func@GOT, %eax + movl func@GOT, %edx + cmpl %edx, %eax + jne .L3 + cmpl %edx, func_p jne .L3 call *func@GOT cmpl $305419896, %eax @@ -24,5 +27,4 @@ check: .L3: call *abort@GOT .size check, .-check - .text .section .note.GNU-stack,"",@progbits diff --git a/ld/testsuite/ld-i386/no-plt-extern1a.S b/ld/testsuite/ld-i386/no-plt-extern1a.S index 38d4dd0..3997a21 100644 --- a/ld/testsuite/ld-i386/no-plt-extern1a.S +++ b/ld/testsuite/ld-i386/no-plt-extern1a.S @@ -16,6 +16,13 @@ call_func: addl $_GLOBAL_OFFSET_TABLE_, %eax jmp *func@GOT(%eax) .size call_func, .-call_func + .globl func_p + .section .data.rel,"aw",@progbits + .align 4 + .type func_p, @object + .size func_p, 4 +func_p: + .long func .section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat .globl __x86.get_pc_thunk.ax .hidden __x86.get_pc_thunk.ax diff --git a/ld/testsuite/ld-i386/no-plt-extern1b.S b/ld/testsuite/ld-i386/no-plt-extern1b.S index ab35bbe..74389f8 100644 --- a/ld/testsuite/ld-i386/no-plt-extern1b.S +++ b/ld/testsuite/ld-i386/no-plt-extern1b.S @@ -12,5 +12,11 @@ get_func: call_func: jmp *func@GOT .size call_func, .-call_func - .section .text.unlikely + .globl func_p + .data + .align 4 + .type func_p, @object + .size func_p, 4 +func_p: + .long func .section .note.GNU-stack,"",@progbits diff --git a/ld/testsuite/ld-x86-64/no-plt-1a.dd b/ld/testsuite/ld-x86-64/no-plt-1a.dd index b2721e3..7c2f5b2 100644 --- a/ld/testsuite/ld-x86-64/no-plt-1a.dd +++ b/ld/testsuite/ld-x86-64/no-plt-1a.dd @@ -10,6 +10,8 @@ Disassembly of section .text: +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 callq [0-9a-f]+ +[a-f0-9]+: 48 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp \$0x[0-9a-f]+,%rax + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ +[a-f0-9]+: 75 2b jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 callq [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-x86-64/no-plt-1b.dd b/ld/testsuite/ld-x86-64/no-plt-1b.dd index ccdc489..13d24b8 100644 --- a/ld/testsuite/ld-x86-64/no-plt-1b.dd +++ b/ld/testsuite/ld-x86-64/no-plt-1b.dd @@ -10,6 +10,8 @@ Disassembly of section .text: +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp +[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+callq \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> +[a-f0-9]+: 48 3b 05 ([0-9a-f]{2} ){4}[ ]+cmp 0x[0-9a-f]+\(%rip\),%rax +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <.*> +[a-f0-9]+: 75 2b jne [0-9a-f]+ +[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+callq \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-x86-64/no-plt-1c.dd b/ld/testsuite/ld-x86-64/no-plt-1c.dd index 2e09a60..75287c9 100644 --- a/ld/testsuite/ld-x86-64/no-plt-1c.dd +++ b/ld/testsuite/ld-x86-64/no-plt-1c.dd @@ -10,6 +10,8 @@ Disassembly of section .text: +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp +[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+callq \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> +[a-f0-9]+: 48 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp \$0x[0-9a-f]+,%rax + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <.*> +[a-f0-9]+: 75 2b jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 callq [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-x86-64/no-plt-1d.dd b/ld/testsuite/ld-x86-64/no-plt-1d.dd index 1920a13..eafed71 100644 --- a/ld/testsuite/ld-x86-64/no-plt-1d.dd +++ b/ld/testsuite/ld-x86-64/no-plt-1d.dd @@ -10,6 +10,8 @@ Disassembly of section .text: +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 callq [0-9a-f]+ +[a-f0-9]+: 48 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp \$0x[0-9a-f]+,%rax + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ +[a-f0-9]+: 75 2b jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 callq [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-x86-64/no-plt-1e.dd b/ld/testsuite/ld-x86-64/no-plt-1e.dd index b0342de..0126abe 100644 --- a/ld/testsuite/ld-x86-64/no-plt-1e.dd +++ b/ld/testsuite/ld-x86-64/no-plt-1e.dd @@ -10,6 +10,8 @@ Disassembly of section .text: +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 callq [0-9a-f]+ +[a-f0-9]+: 48 3b 05 ([0-9a-f]{2} ){4}[ ]+cmp 0x[0-9a-f]+\(%rip\),%rax +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ +[a-f0-9]+: 75 2b jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 callq [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-x86-64/no-plt-1f.dd b/ld/testsuite/ld-x86-64/no-plt-1f.dd index ccdc489..13d24b8 100644 --- a/ld/testsuite/ld-x86-64/no-plt-1f.dd +++ b/ld/testsuite/ld-x86-64/no-plt-1f.dd @@ -10,6 +10,8 @@ Disassembly of section .text: +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp +[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+callq \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> +[a-f0-9]+: 48 3b 05 ([0-9a-f]{2} ){4}[ ]+cmp 0x[0-9a-f]+\(%rip\),%rax +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <.*> +[a-f0-9]+: 75 2b jne [0-9a-f]+ +[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+callq \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-x86-64/no-plt-1g.dd b/ld/testsuite/ld-x86-64/no-plt-1g.dd index 0c97097..5a3dd17 100644 --- a/ld/testsuite/ld-x86-64/no-plt-1g.dd +++ b/ld/testsuite/ld-x86-64/no-plt-1g.dd @@ -10,6 +10,8 @@ Disassembly of section .text: +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp +[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4}[ ]+callq \*0x[0-9a-f]+\(%rip\) +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> +[a-f0-9]+: 48 3b 05 ([0-9a-f]{2} ){4}[ ]+cmp 0x[0-9a-f]+\(%rip\),%rax +# [0-9a-f]+ <_DYNAMIC\+0x[0-9a-f]+> + +[a-f0-9]+: 75 34 jne [0-9a-f]+ + +[a-f0-9]+: 4(0|8) 39 05 ([0-9a-f]{2} ){4}[ ]+(rex |)cmp +%(e|r)ax,0x[0-9a-f]+\(%rip\) +# [a-f0-9]+ <.*> +[a-f0-9]+: 75 2b jne [0-9a-f]+ +[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr32 callq [0-9a-f]+ +[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax diff --git a/ld/testsuite/ld-x86-64/no-plt-check1.S b/ld/testsuite/ld-x86-64/no-plt-check1.S index 5bacb3f..61d32b1 100644 --- a/ld/testsuite/ld-x86-64/no-plt-check1.S +++ b/ld/testsuite/ld-x86-64/no-plt-check1.S @@ -10,6 +10,13 @@ check: call *get_func@GOTPCREL(%rip) cmpq func@GOTPCREL(%rip), %rax jne .L3 +#ifdef __LP64__ + cmpq %rax, func_p(%rip) +#else + rex + cmpl %eax, func_p(%rip) +#endif + jne .L3 call *func@GOTPCREL(%rip) cmpl $305419896, %eax jne .L3 diff --git a/ld/testsuite/ld-x86-64/no-plt-extern1.S b/ld/testsuite/ld-x86-64/no-plt-extern1.S index 3957f39..0d5820f 100644 --- a/ld/testsuite/ld-x86-64/no-plt-extern1.S +++ b/ld/testsuite/ld-x86-64/no-plt-extern1.S @@ -12,4 +12,17 @@ get_func: call_func: jmp *func@GOTPCREL(%rip) .size call_func, .-call_func + .globl func_p + .section .data.rel,"aw",@progbits + .type func_p, @object +func_p: +#ifdef __LP64__ + .align 8 + .size func_p, 8 + .quad func +#else + .align 4 + .size func_p, 4 + .long func +#endif .section .note.GNU-stack,"",@progbits