This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: %pc relative addressing of string literals/const data
On Oct 6, 2010, at 6:52 AM, Ian Lance Taylor wrote:
> Joakim Tjernlund <joakim.tjernlund@transmode.se> writes:
>
>> I really wish mrelocatable is added to all archs. The normal ELF relocs
>> are too big to fit well in u-boot.
>
> Every architecture is different and requires a thoughtful approach to
> determine the best way to handle these issues for that architecture.
>
> Also, since every architecture is different, somebody has to do the work
> for each architecture separately, and it has to be done by somebody
> familiar with the architecture and with a way to test the results.
> There may be some common code that could be shared, but not much.
Not that it really matter in this discussion, but the VAX backend produces
references that are pc-relative by default (producing PIC code is the default).
(-O2 -fpic)
foo:
.word 0x0
subl2 $4,%sp
addl3 x,y,%r0
Note that ld does the heavy lifting to convert the x and y relocations to
indirect GOT references if needed so no explicit references to the GOT are
needed.