%pc relative addressing of string literals/const data
Joakim Tjernlund
joakim.tjernlund@transmode.se
Tue Oct 5 21:41:00 GMT 2010
Richard Henderson <rth@redhat.com> wrote on 2010/10/05 23:12:19:
>
> On 10/05/2010 01:55 PM, Joakim Tjernlund wrote:
> > I don't do x86 or alpha so let me ask: If you run the code on an address
> > != link address, will it do the right thing?
>
> Yes of course. It wouldn't be -fpic code otherwise.
Just making sure
>
> > I tested the #pragma/no #pragma on PPC and the resulting code
> > was the same:
>
> Yes of course. I said it wouldn't on PPC.
Here too :)
>
> > You can get at the GOT table using PC relative addressing so why not
> > strings or data in a similar fashion?
>
> Well, I suppose you could, with the right code model. It's not
> compatible with generic -fpic code without using a second base
> register, which is unfortunate.
yes, but this could be a new PIC mode that uses a new better
PIC mode for everything. Especially one that doesn't require each function
to calculate the GOT address in the function prologue(why is that so?)
Jocke
More information about the Gcc
mailing list