[U-Boot] [PATCH] mpc83xx: Add -fpic relocation support
Joakim Tjernlund
joakim.tjernlund at transmode.se
Tue Oct 12 15:04:31 CEST 2010
Wolfgang Denk <wd at denx.de> wrote on 2010/10/12 14:52:18:
>
> Dear Joakim Tjernlund,
>
> In message
<1286887081-23172-1-git-send-email-Joakim.Tjernlund at transmode.se> you
wrote:
> > This add relocation of .got entries produced
> > by -fpic. -fpic produces 2-3% smaller code and
> > is faster. Unfortunately gcc promotes -fpic to
> > -fPIC when -mrelocatable is used so one need a very
> > small patch to gcc too(sent upstream).
>
> What happens when one uses this patch in combination with a "standard"
> (i. e. older, unpatched) GCC?
Nothing, gcc will produce -fPIC relocs and the code will/should just work.
>
> > START_GOT
> > GOT_ENTRY(_GOT2_TABLE_)
> > + GOT_ENTRY(_GOT_TABLE_)
> > + GOT_ENTRY(_GLOBAL_OFFSET_TABLE_)
> > GOT_ENTRY(__bss_start)
> > GOT_ENTRY(_end)
> >
> > @@ -951,6 +953,22 @@ in_ram:
> > stw r0,0(r3)
> > 2: bdnz 1b
> >
> > + lwz r4,GOT(_GLOBAL_OFFSET_TABLE_)
>
> What exactly is _GLOBAL_OFFSET_TABLE_ good for, and how does it differ
> from _GOT_TABLE_ ?
_GLOBAL_OFFSET_TABLE_ is a predefined symbol that the linker defines to
be in the middle of the -fpic GOT table. It marks the end of the GOT table
as far as we are concerned(u-boot does not generate so many relocs that
the
linker needs to use the space above _GLOBAL_OFFSET_TABLE_)
There is no predefined symbol that marks the start of fpic relocs so
one is added(_GOT_TABLE_) by me to the linker script.
Jocke
More information about the U-Boot
mailing list