From: H.J. Lu Date: Wed, 15 Jun 2016 16:44:21 +0000 (-0700) Subject: X86: Add tests for static function pointer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3a4b0e0f9670679f8942f2bd57aa86ae0412b171;p=binutils-gdb.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 516b4bbb987..0da9a928060 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 8fcf9cfd295..e5bd9bdcd1e 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 5af3471b534..2d35336945e 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 ebfc403c910..cc5fc1738a0 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 246b2521ad6..396dbf390c6 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 2787dae8819..6f271992f90 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 5af3471b534..2d35336945e 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 546c16dc644..f9464e7135c 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 9d07d396809..0d662c930d7 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 d6f93b73f44..05e2d6de4d3 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 50fd6934ffc..258b0a04d64 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 1699dbee273..82d186bc2c5 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 d27ab830db6..aeee9402319 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 38d4dd07f39..3997a2191c8 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 ab35bbe5544..74389f87ec3 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 b2721e33bae..7c2f5b2fead 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 ccdc4896b61..13d24b8878a 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 2e09a6099e7..75287c91b5b 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 1920a13e854..eafed71ce4a 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 b0342de6d60..0126abe7f87 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 ccdc4896b61..13d24b8878a 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 0c9709753f6..5a3dd17ad3e 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 5bacb3fe4a2..61d32b15f8b 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 3957f3964d9..0d5820f5ebf 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