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

Haavard Skinnemoen haavard.skinnemoen at atmel.com
Fri Jul 25 14:19:09 CEST 2008


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.

> 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).

Haavard




More information about the U-Boot mailing list