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

Haavard Skinnemoen haavard.skinnemoen at atmel.com
Fri Jul 25 11:16:10 CEST 2008


On Thu, 24 Jul 2008 19:12:20 +0200
Kenneth Johansson <kenneth at southpole.se> wrote:

> > We could build u-boot as a shared library I guess, but that feels a bit
> > weird...  
> 
> What do you mean by that ? u-boot is already compiled with the -fPIC
> option. 

If that's sufficient, why would you need the -mrelocatable option on
PowerPC?

-fPIC makes the compiler generate position-independent code, which is
necessary but not sufficient in order to get a fully relocatable
binary. The second part of the puzzle is dynamic relocations. Shared
libraries have them, and apparently, PowerPC binaries have them if you
link with -mrelocatable.

Currently u-boot is compiled with -fPIC, so the result is almost fully
relocatable. We work around the lack of dynamic relocations by manually
fixing up a handful of pointers at runtime.

Haavard




More information about the U-Boot mailing list