X86: Add tests for static function pointer
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 15 Jun 2016 16:44:21 +0000 (09:44 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 15 Jun 2016 16:44:21 +0000 (09:44 -0700)
* 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.

24 files changed:
ld/ChangeLog
ld/testsuite/ld-i386/no-plt-1a.dd
ld/testsuite/ld-i386/no-plt-1b.dd
ld/testsuite/ld-i386/no-plt-1c.dd
ld/testsuite/ld-i386/no-plt-1d.dd
ld/testsuite/ld-i386/no-plt-1e.dd
ld/testsuite/ld-i386/no-plt-1f.dd
ld/testsuite/ld-i386/no-plt-1g.dd
ld/testsuite/ld-i386/no-plt-1h.dd
ld/testsuite/ld-i386/no-plt-1i.dd
ld/testsuite/ld-i386/no-plt-1j.dd
ld/testsuite/ld-i386/no-plt-check1a.S
ld/testsuite/ld-i386/no-plt-check1b.S
ld/testsuite/ld-i386/no-plt-extern1a.S
ld/testsuite/ld-i386/no-plt-extern1b.S
ld/testsuite/ld-x86-64/no-plt-1a.dd
ld/testsuite/ld-x86-64/no-plt-1b.dd
ld/testsuite/ld-x86-64/no-plt-1c.dd
ld/testsuite/ld-x86-64/no-plt-1d.dd
ld/testsuite/ld-x86-64/no-plt-1e.dd
ld/testsuite/ld-x86-64/no-plt-1f.dd
ld/testsuite/ld-x86-64/no-plt-1g.dd
ld/testsuite/ld-x86-64/no-plt-check1.S
ld/testsuite/ld-x86-64/no-plt-extern1.S

index 516b4bbb9876472ed93ec95723eed55f74ddfde6..0da9a928060c1e3e4817b591def0f0255b0f2ad4 100644 (file)
@@ -1,3 +1,31 @@
+2016-06-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * 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  <senthil_kumar.selvaraj@atmel.com>
 
        PR ld/20254
index 8fcf9cfd2951bb1f0de8a450909764e703b892f4..e5bd9bdcd1eed61798b937f38bffe73d45b2df2c 100644 (file)
@@ -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]+ <get_func>
  +[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]+ <check\+0x[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]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index 5af3471b53407a5ed0285e97acac9e5159e749ac..2d35336945e2ca729add8e4df7434a82fd53b703 100644 (file)
@@ -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]+ <check\+0x[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]+ <check\+0x[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
index ebfc403c910591bf01a3a599db087daafed73653..cc5fc1738a0ab60a36002d371b68cc51c980cd3b 100644 (file)
@@ -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]+ <check\+0x[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]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index 246b2521ad655abae9f26c710fec48821a8ad5a3..396dbf390c67aaf2eeaf3064f731d7dbe55b0c62 100644 (file)
@@ -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]+ <get_func>
  +[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]+ <check\+0x[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]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index 2787dae88196f3f7b959a4c78a5062b3fab25523..6f271992f90294f0f683598cc95234a7a56bbd14 100644 (file)
@@ -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]+ <get_func>
  +[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]+ <check\+0x[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]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index 5af3471b53407a5ed0285e97acac9e5159e749ac..2d35336945e2ca729add8e4df7434a82fd53b703 100644 (file)
@@ -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]+ <check\+0x[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]+ <check\+0x[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
index 546c16dc644c97c893903c293de3e101cb358d15..f9464e7135c01896ca6393364c4d56c4552deea0 100644 (file)
@@ -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]+ <check\+0x[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]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index 9d07d396809467163bb1cf3465993e8a8ac14a7b..0d662c930d79a3fe48b8a605377cf92f9d19d22c 100644 (file)
@@ -9,7 +9,10 @@ Disassembly of section .text:
 [0-9a-f]+ <check>:
  +[a-f0-9]+:   83 ec 0c                sub    \$0xc,%esp
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <get_func>
- +[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]+ <check\+0x[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]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index d6f93b73f4402fa7c1b0a1c83bd2427a568f3d34..05e2d6de4d3407ac50416f81a72c90aecd5c0e44 100644 (file)
@@ -9,7 +9,10 @@ Disassembly of section .text:
 [0-9a-f]+ <check>:
  +[a-f0-9]+:   83 ec 0c                sub    \$0xc,%esp
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <get_func>
- +[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]+ <check\+0x[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]+ <check\+0x[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
index 50fd6934ffce905def38c3760d13cec45d15e376..258b0a04d6407c1b5aea9fc940489751621a62c4 100644 (file)
@@ -9,7 +9,10 @@ Disassembly of section .text:
 [0-9a-f]+ <check>:
  +[a-f0-9]+:   83 ec 0c                sub    \$0xc,%esp
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <get_func>
- +[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]+ <check\+0x[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]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index 1699dbee273a94a2c830433b5dd7f86a9a157792..82d186bc2c5a8c513b1bfc999d426c9e64cf9a3d 100644 (file)
@@ -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
index d27ab830db64f167116eed5dba64209d3329dad7..aeee940231910f6ea18ff529f4d246e5581c713b 100644 (file)
@@ -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
index 38d4dd07f39b5c8d0ac55d5a83cc5c1909f48d16..3997a2191c8fb12fe4ff5f3bd42bc928b6b09907 100644 (file)
@@ -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
index ab35bbe554442c87130d0b915998a0387b407b1f..74389f87ec3efe469cc9925813f6d5fd56728885 100644 (file)
@@ -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
index b2721e33bae4e60a28b9039a3c05625a35b0848b..7c2f5b2feadb798188f06e1f9fd19d1e74d513ee 100644 (file)
@@ -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]+ <get_func>
  +[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]+ <check\+0x[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]+ <func_p>
  +[a-f0-9]+:   75 2b                   jne    [0-9a-f]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr32 callq [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index ccdc4896b612ce3842f1772a88960119af8b8bb3..13d24b8878a50f7d42873e14119e402c27b59cd5 100644 (file)
@@ -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]+ <check\+0x[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]+ <check\+0x[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
index 2e09a6099e7c5b1dee5fa03dc549f8c88b6cee3b..75287c91b5b1a213acc7e6d664208bbc93c3717b 100644 (file)
@@ -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]+ <check\+0x[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]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr32 callq [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index 1920a13e854c6e47e98183248c722846c3d95cb6..eafed71ce4ab05b11f0d21ab3318bc3dc81c82f6 100644 (file)
@@ -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]+ <get_func>
  +[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]+ <check\+0x[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]+ <func_p>
  +[a-f0-9]+:   75 2b                   jne    [0-9a-f]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr32 callq [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index b0342de6d60cbf01c4288d309352f23c8d47725b..0126abe7f878667729d95605a4223159ad3d4f90 100644 (file)
@@ -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]+ <get_func>
  +[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]+ <check\+0x[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]+ <func_p>
  +[a-f0-9]+:   75 2b                   jne    [0-9a-f]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr32 callq [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index ccdc4896b612ce3842f1772a88960119af8b8bb3..13d24b8878a50f7d42873e14119e402c27b59cd5 100644 (file)
@@ -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]+ <check\+0x[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]+ <check\+0x[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
index 0c9709753f6ac0d814def628023ff364ad7ec278..5a3dd17ad3e934ff340da7943ca0c26771654be6 100644 (file)
@@ -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]+ <check\+0x[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]+ <check\+0x[0-9a-f]+>
  +[a-f0-9]+:   67 e8 ([0-9a-f]{2} ){4}[        ]+addr32 callq [0-9a-f]+ <func>
  +[a-f0-9]+:   3d 78 56 34 12          cmp    \$0x12345678,%eax
index 5bacb3fe4a2858e27f6a0aebbd3ce0b6a1dbaa5a..61d32b15f8be58f82d5722b6198431e04359d681 100644 (file)
@@ -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
index 3957f3964d9b9d3bd0cb1ca0358f8e723712ad8e..0d5820f5ebf7d0cefb8d8e150bf0d15b20c58fe4 100644 (file)
@@ -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