This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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 target/26553] New: PIC stubs vs regparm


While looking at PR 26552, I noticed that stubs would override eax, that is
wrong as it is used to pass regparms.

Testcase:
int f(int ) __attribute__((regparm(3)));

int g(void)
{
  return f(1);
}
------
We get:
_g:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    $1, %eax
        call    L_f$stub
        leave
        ret
        .picsymbol_stub
L_f$stub:
        .indirect_symbol _f
        call LPC$1
LPC$1:  popl %eax
        movl L1$lz-LPC$1(%eax),%edx
        jmp *%edx
L_f$stub_binder:
        lea L1$lz-LPC$1(%eax),%eax
        pushl %eax
        jmp dyld_stub_binding_helper
L1$lz:
        .indirect_symbol _f
        .long L_f$stub_binder

So we get eax clobbered each time calling the stub.


-- 
           Summary: PIC stubs vs regparm
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: i686-darwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26553


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