[U-Boot-Users] Changing u-boot relocation scheme

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Fri Jul 25 15:30:21 CEST 2008


> -----Original Message-----
> From: u-boot-users-bounces at lists.sourceforge.net [mailto:u-boot-users-bounces at lists.sourceforge.net]
> On Behalf Of Haavard Skinnemoen
> Sent: den 25 juli 2008 14:19
> To: kenneth johansson
> Cc: vb; u-boot-users at lists.sourceforge.net; Wolfgang Denk
> Subject: Re: [U-Boot-Users] Changing u-boot relocation scheme
> 
> On Fri, 25 Jul 2008 13:55:58 +0200
> kenneth johansson <kenneth at southpole.se> wrote:
> 
> > > An ELF shared library has the dynamic relocations we need. So if we
> > > build u-boot as an .so file, it should work in theory on most
> > > architectures.
> >
> > well the elf binary of u-boot obviously has everything we need
> > regardless of what options it was compiled with. If we had a full linker
> > at runtime we could just do a relink to whatever address we wanted.
> 
> No we couldn't if we don't have any relocation information. Just as you
> can't relink just any ELF binary to run at a different location after
> it's been through a final link, no matter how "full" the linker is.
> 
> And if the ELF file wasn't compiled as position-independent code to
> begin with, there's just no way it will ever work if it's loaded at a
> different address than it was linked at. You can't go through and fix
> up all the compiler-generated address calculations when you don't even
> have a clue where they are!
> 
> So whether or not the u-boot ELF file has everything we need depends a
> _lot_ on what options were used when building it.

Exactly.

> 
> > It sounds a bit easier to just loop over a list of pointers and change
> > the values than to implement a complete linker but maybe that is just
> > me.
> 
> The question remains how should that list of pointers be generated? One
> possible answer is to let the linker do it (as dynamic relocations).

I think the best bet is to make -mrelocatable work for PPC. Question is how
does the other arches do it? Do they include fixup ptrs by default or do
they lack this functionality?

  Jocke
> 
> Haavard






More information about the U-Boot mailing list