https://sourceware.org/bugzilla/show_bug.cgi?id=18886

            Bug ID: 18886
           Summary: Unnecessary PLT entry for IFUNC function from DSO
           Product: binutils
           Version: 2.26 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: hjl.tools at gmail dot com
                CC: ian at airs dot com
  Target Milestone: ---

[hjl@gnu-6 tmp]$ cat x.s
        .text
        .globl foo      
        .type   foo, @function
foo:
        jmp     *strcmp@GOTPCREL(%rip)
[hjl@gnu-6 tmp]$ gcc -c x.s
[hjl@gnu-6 tmp]$ ld.gold -shared x.o
[hjl@gnu-6 tmp]$ objdump -dwr a.out 

a.out:     file format elf64-x86-64


Disassembly of section .text:

0000000000000220 <foo>:
 220:   ff 25 f2 10 00 00       jmpq   *0x10f2(%rip)        # 1318
<_DYNAMIC+0xf0>
[hjl@gnu-6 tmp]$ ld.gold -shared x.o -lc -L/usr/lib64
[hjl@gnu-6 tmp]$ objdump -dwr a.out 

a.out:     file format elf64-x86-64


Disassembly of section .plt:

00000000000002a0 <strcmp@plt-0x10>:
 2a0:   ff 35 f2 11 00 00       pushq  0x11f2(%rip)        # 1498
<_GLOBAL_OFFSET_TABLE_+0x8>
 2a6:   ff 25 f4 11 00 00       jmpq   *0x11f4(%rip)        # 14a0
<_GLOBAL_OFFSET_TABLE_+0x10>
 2ac:   90                      nop
 2ad:   90                      nop
 2ae:   90                      nop
 2af:   90                      nop

00000000000002b0 <strcmp@plt>:
 2b0:   ff 25 f2 11 00 00       jmpq   *0x11f2(%rip)        # 14a8
<_GLOBAL_OFFSET_TABLE_+0x18>
 2b6:   68 00 00 00 00          pushq  $0x0
 2bb:   e9 e0 ff ff ff          jmpq   2a0 <strcmp@plt-0x10>

Disassembly of section .text:

00000000000002c0 <foo>:
 2c0:   ff 25 c2 11 00 00       jmpq   *0x11c2(%rip)        # 1488
<_DYNAMIC+0x180>
[hjl@gnu-6 tmp]$ 

Gold shouldn't add strcmp to PLT because strcmp is IFUNC in libc.so.6.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to