Re: %ebx vs %ecx

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

 



On Sat, Jul 24, 2010 at 7:51 PM, Mathieu Lacage
<mathieu.lacage@xxxxxxxxx> wrote:
> I wonder if it is possible to know which register the compiler is
> going to use to generate PIC code on ia32. i.e., most of the
> references I found mention only ebx but the only ia32 system I have
> access to (Xeon E5410) which is running FC10 and gcc 4.3.2 compiles a
> sample foo function accessing a global variable with the ecx register.
> Is there any ABI rule about which register is supposed to be used ? If
> the compiler free to use any register ? Does it really use _any_
> register in practice ?

The answer is that, in practice, leaf functions which access global
variables are free to (and thus do) use any register to store the base
address of the GOT so that they do not have to save and restore the
%ebx register (which is supposed to callee-saved).

Mathieu
-- 
Mathieu Lacage <mathieu.lacage@xxxxxxxxx>


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux