This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: add crt files
On Wed, Feb 8, 2012 at 12:18 PM, Ryan S. Arnold <ryan.arnold@gmail.com> wrote:
> On Wed, Feb 8, 2012 at 12:12 PM, Roland McGrath <roland@hack.frob.com> wrote:
>>> + Â Â .section .init,"ax",@progbits
>>> + Â Â .align Â2
>>
>> Let's stick to .p2align or .balign to make things clearer.
>>
>>> +_init:
>>> + Â Â stwu r1, -16(r1)
>>> + Â Â mflr r0
>>> + Â Â stw r0, 20(r1)
>>> + Â Â stw r30, 8(r1)
>>
>> I don't really know ppc code, but this looks like it's setting up a frame
>> pointer. ÂIs that really necessary?
>>
>>
>> Thanks,
>> Roland
>
> We're taking a look at this exact thing right now.
The stwu r1, -16(r1) does indeed stack a frame. Stacking a frame is
required for non-leaf functions in the 32-bit PPC ABI.
The stw r0, 20(r1) is saving the LR to the previous frame's LR Save slot.
The stw r30,8(r1) is saving the general-purpose register r30, which is
marked as a non-volatile (and therefore must be saved prior to
branch), to the register save area.
So yes this sequence is necessary.
We're looking at a difference in the version generated for Power7
where the frame size is 32 bytes before I ack this.
Ryan