This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/19745] New: Avoid extra branch to PLT entry when calling external function


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

            Bug ID: 19745
           Summary: Avoid extra branch to PLT entry when calling external
                    function
           Product: glibc
           Version: 2.24
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---
            Target: x86-64

On x86-64, calling external function, foo, with

call foo@PLT

results in branching to PLT entry:

000000000001f7a0 <foo@plt>:
   1f7a0:       ff 25 82 c8 37 00       jmpq   *0x37c882(%rip)        # 39c028
<_GLOBAL_OFFSET_TABLE_+0x28>
   1f7a6:       68 00 00 00 00          pushq  $0x0
   1f7ab:       e9 c0 ff ff ff          jmpq   1f770

Instead, we can use

call *foo@GOTPCREL(%rip)

which leads to "call *0x37c882(%rip)" without going through PLT.

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]