[U-Boot-Users] [PPC] PLEASE READ - was: [PATCH] Fix linker scripts: add NOLOAD atribute to .bss/.sbss sections

Joakim Tjernlund
2008-02-07T00:20:34Z

> -----Original Message-----
> From: wd at denx.de [mailto:wd at denx.de]
> Sent: den 6 februari 2008 23:11
> To: joakim.tjernlund at transmode.se
> Cc: Scott Wood; u-boot-users at lists.sourceforge.net; Stefan Roese
> Subject: Re: [U-Boot-Users] [PPC] PLEASE READ - was: [PATCH] Fix linker scripts: add NOLOAD atribute
> to .bss/.sbss sections
>
> In message <1202291955.25864.43.camel@gentoo-jocke.transmode.se> you wrote:
> >
> > I think the register approach is needed if we ever want to
> > make u-boot fully relocateable.
>
> Good point.
>
> > There are a few global data accesses that needs to be fixed
> > before that can happen though. There should not be any global data
> > accesses before relocate_code has done its thing. One of the
> > first things that happens in board_init_f is:
> > for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
> > if ((*init_fnc_ptr) () != 0) {
> > hang ();
> > }
> > }
> > init_sequence is a global variable.
> >
> > Is this table really needed? Why not move it inside board_init_f and
> > save some bytes?
>
> The original idea of the table was that a user could provide (in his
> board config file) a private version to allow for easy, #ifdef free
> board specific initialization sequences.
>
> Unfortunately I never found the time or resources to complete this.

I see, there are a lot of #ifdef in there that can be made more generic
to cut down on the #ifdef's to a minimum. I read between the lines that you
would not object too much if the table was removed?

>
>
> > The next is access is env_get_char, this probably needs to move into GD.
> >
> > I figured global data accesses wasn't allowed(other than GD) at all
> > before relocate_code()?
>
> They are not exactly forbidden, you just have to know exactly what you
> can expect - i. e., usually they just don't make much sense ;-)

Yeah, sadly I just noticed that constant strings are referenced via the
GOT so you can't print those for PPC if you want to make it relocateable.

Any idea how to avoid GOT references for constant strings?

Jocke
>
> Best regards,
>
> Wolfgang Denk