bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/20253] New: Unnecessary PLT entry for IFUNC function via GOT


From: hjl.tools at gmail dot com
Subject: [Bug ld/20253] New: Unnecessary PLT entry for IFUNC function via GOT
Date: Tue, 14 Jun 2016 00:36:27 +0000

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

            Bug ID: 20253
           Summary: Unnecessary PLT entry for IFUNC function via GOT
           Product: binutils
           Version: 2.27 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: x86

address@hidden saved]$ cat x.S
        .text
        .globl  foo
        .type   foo, @gnu_indirect_function
foo:
        ret
        .text
        .type   bar, @gnu_indirect_function
bar:
        ret
        .globl  _start
        .type   _start, @function
_start:
#ifdef __x86_64__
        call    address@hidden(%rip)
        jmp     address@hidden(%rip)
        movq    $0, address@hidden(%rip)
        cmpq    $0, address@hidden(%rip)
        cmpq    address@hidden(%rip), %rcx
        cmpq    address@hidden(%rip), %rcx
#else
        call    address@hidden
        jmp     address@hidden
        movl    $0, address@hidden
        cmpl    $0, address@hidden
        cmpl    address@hidden, %ecx
        cmpl    address@hidden, %ecx
#endif
address@hidden saved]$ make x32
gcc -B./ -c -mx32 -o x32.o x.S
ld -z nocombreloc -m elf32_x86_64 -o x32 x32.o
objdump -dw x32

x32:     file format elf32-x86-64


Disassembly of section .plt:

00400090 <.plt>:
  400090:       ff 25 62 00 20 00       jmpq   *0x200062(%rip)        # 6000f8
<_GLOBAL_OFFSET_TABLE_+0x18>
  400096:       68 00 00 00 00          pushq  $0x0
  40009b:       e9 00 00 00 00          jmpq   4000a0 <foo-0x10>
  4000a0:       ff 25 5a 00 20 00       jmpq   *0x20005a(%rip)        # 600100
<_GLOBAL_OFFSET_TABLE_+0x20>
  4000a6:       68 00 00 00 00          pushq  $0x0
  4000ab:       e9 00 00 00 00          jmpq   4000b0 <foo>

Disassembly of section .text:

004000b0 <foo>:
  4000b0:       c3                      retq   

004000b1 <bar>:
  4000b1:       c3                      retq   

004000b2 <_start>:
  4000b2:       ff 15 40 00 20 00       callq  *0x200040(%rip)        # 6000f8
<_GLOBAL_OFFSET_TABLE_+0x18>
  4000b8:       ff 25 42 00 20 00       jmpq   *0x200042(%rip)        # 600100
<_GLOBAL_OFFSET_TABLE_+0x20>
  4000be:       48 c7 05 37 00 20 00 00 00 00 00        movq  
$0x0,0x200037(%rip)        # 600100 <_GLOBAL_OFFSET_TABLE_+0x20>
  4000c9:       48 83 3d 27 00 20 00 00         cmpq   $0x0,0x200027(%rip)     
  # 6000f8 <_GLOBAL_OFFSET_TABLE_+0x18>
  4000d1:       48 3b 0d 20 00 20 00    cmp    0x200020(%rip),%rcx        #
6000f8 <_GLOBAL_OFFSET_TABLE_+0x18>
  4000d8:       48 3b 0d 21 00 20 00    cmp    0x200021(%rip),%rcx        #
600100 <_GLOBAL_OFFSET_TABLE_+0x20>
address@hidden saved]$ make i386
gcc -B./ -c -m32 -o i386.o x.S
ld -z nocombreloc -m elf_i386 -o i386 i386.o
objdump -dw i386

i386:     file format elf32-i386


Disassembly of section .plt:

08048090 <.plt>:
 8048090:       ff 25 e8 90 04 08       jmp    *0x80490e8
 8048096:       68 00 00 00 00          push   $0x0
 804809b:       e9 00 00 00 00          jmp    80480a0 <foo-0x10>
 80480a0:       ff 25 ec 90 04 08       jmp    *0x80490ec
 80480a6:       68 00 00 00 00          push   $0x0
 80480ab:       e9 00 00 00 00          jmp    80480b0 <foo>

Disassembly of section .text:

080480b0 <foo>:
 80480b0:       c3                      ret    

080480b1 <bar>:
 80480b1:       c3                      ret    

080480b2 <_start>:
 80480b2:       ff 15 e8 90 04 08       call   *0x80490e8
 80480b8:       ff 25 ec 90 04 08       jmp    *0x80490ec
 80480be:       c7 05 ec 90 04 08 00 00 00 00   movl   $0x0,0x80490ec
 80480c8:       83 3d e8 90 04 08 00    cmpl   $0x0,0x80490e8
 80480cf:       3b 0d e8 90 04 08       cmp    0x80490e8,%ecx
 80480d5:       3b 0d ec 90 04 08       cmp    0x80490ec,%ecx
address@hidden saved]$ make x86_64
gcc -B./ -c -m64 -o x86_64.o x.S
ld -z nocombreloc -m elf_x86_64 -o x86_64 x86_64.o
objdump -dw x86_64

x86_64:     file format elf64-x86-64


Disassembly of section .plt:

00000000004000e0 <.plt>:
  4000e0:       ff 25 62 00 20 00       jmpq   *0x200062(%rip)        # 600148
<_GLOBAL_OFFSET_TABLE_+0x18>
  4000e6:       68 00 00 00 00          pushq  $0x0
  4000eb:       e9 00 00 00 00          jmpq   4000f0 <foo-0x10>
  4000f0:       ff 25 5a 00 20 00       jmpq   *0x20005a(%rip)        # 600150
<_GLOBAL_OFFSET_TABLE_+0x20>
  4000f6:       68 00 00 00 00          pushq  $0x0
  4000fb:       e9 00 00 00 00          jmpq   400100 <foo>

Disassembly of section .text:

0000000000400100 <foo>:
  400100:       c3                      retq   

0000000000400101 <bar>:
  400101:       c3                      retq   

0000000000400102 <_start>:
  400102:       ff 15 40 00 20 00       callq  *0x200040(%rip)        # 600148
<_GLOBAL_OFFSET_TABLE_+0x18>
  400108:       ff 25 42 00 20 00       jmpq   *0x200042(%rip)        # 600150
<_GLOBAL_OFFSET_TABLE_+0x20>
  40010e:       48 c7 05 37 00 20 00 00 00 00 00        movq  
$0x0,0x200037(%rip)        # 600150 <_GLOBAL_OFFSET_TABLE_+0x20>
  400119:       48 83 3d 27 00 20 00 00         cmpq   $0x0,0x200027(%rip)     
  # 600148 <_GLOBAL_OFFSET_TABLE_+0x18>
  400121:       48 3b 0d 20 00 20 00    cmp    0x200020(%rip),%rcx        #
600148 <_GLOBAL_OFFSET_TABLE_+0x18>
  400128:       48 3b 0d 21 00 20 00    cmp    0x200021(%rip),%rcx        #
600150 <_GLOBAL_OFFSET_TABLE_+0x20>
address@hidden saved]$ 

All of PLT entries should be removed.

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]