[U-Boot] [PATCH 6/6] powerpc: Add LINK_OFF calls in early C-code.

Joakim Tjernlund joakim.tjernlund at transmode.se
Tue Nov 23 22:03:36 CET 2010


Scott Wood <scottwood at freescale.com> wrote on 2010/11/23 21:46:51:
> On Tue, 23 Nov 2010 19:48:51 +0100
> Joakim Tjernlund <Joakim.Tjernlund at transmode.se> wrote:
>
> > Only these 2 call sites depends on fixups for my mpc8321 based
> > board.
> > ---
> >  arch/powerpc/cpu/mpc83xx/cpu_init.c |    2 +-
> >  arch/powerpc/lib/board.c            |    2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c b/arch/powerpc/cpu/mpc83xx/cpu_init.c
> > index f3b67ae..0437b49 100644
> > --- a/arch/powerpc/cpu/mpc83xx/cpu_init.c
> > +++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c
> > @@ -534,7 +534,7 @@ int prt_83xx_rsr(void)
> >     sep = " ";
> >     for (i = 0; i < n; i++)
> >        if (rsr & bits[i].mask) {
> > -         printf("%s%s", sep, bits[i].desc);
> > +         printf("%s%s", sep, LINK_OFF(bits[i].desc));
> >           sep = ", ";
> >        }
> >     puts("\n");
> > diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
> > index 7b09fb5..9fa99dc 100644
> > --- a/arch/powerpc/lib/board.c
> > +++ b/arch/powerpc/lib/board.c
> > @@ -386,7 +386,7 @@ void board_init_f (ulong bootflag)
> >  #endif
> >
> >     for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
> > -      if ((*init_fnc_ptr) () != 0) {
> > +      if ((LINK_OFF(*init_fnc_ptr)) () != 0) {
> >           hang ();
> >        }
> >     }
>
> "Only these" that you've found so far, for the board you've tried --

Yes, that is what I wrote. The previous try had LINK_OFF calls all over the
place just for my board.

> is it worth adding another pre-relocation landmine to shrink the image
> by 5%?  I don't miss the manual fixups we had to do under the old
> relocation scheme.

-msingle-pic-base does not require LINK_OFF per se. It will shrink the image
significantly for free. It enables impl. of true PIC and if you want to have
that too you need LINK_OFF.

> Please document the specific circumstances in which one would need
> to use this (any data-segment pointer before relocation?).

Any ptr needing fixups:
char *sptr = "hi";
Same for static initialized function ptrs too.

> Is a missing LINK_OFF likely to result in a crash, or silent bad
> behavior?  Will LINK_OFF be a no-op after relocation?

Either crash or garbage printed on the port.
LINK_OFF is a NOP after relocation. It will be a NOP
if link address == load address too.

 Jocke



More information about the U-Boot mailing list