[llvm-bugs] [Bug 27589] New: large position independent x86 code

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 30 11:19:08 PDT 2016


            Bug ID: 27589
           Summary: large position independent x86 code
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: hans at chromium.org, llvm-bugs at lists.llvm.org
    Classification: Unclassified

When compiling

extern int a;
int *f() {
  return &a;

Clang generates the following for finding the current ip address:

        calll   .L0$pb
        popl    %eax
        addl    $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %eax
        movl    a at GOT(%eax), %eax

which is 19 bytes.

gcc produces

        call    __x86.get_pc_thunk.ax
        addl    $_GLOBAL_OFFSET_TABLE_, %eax
        movl    a at GOT(%eax), %eax

.text.__x86.get_pc_thunk.ax,"axG", at progbits,__x86.get_pc_thunk.ax,comdat
        .globl  __x86.get_pc_thunk.ax
        .hidden __x86.get_pc_thunk.ax
        movl    (%esp), %eax

While the total code is now 21 bytes, f is 17 bytes and __x86.get_pc_thunk.ax
will be merged by the linker.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160430/990ff349/attachment.html>

More information about the llvm-bugs mailing list