From mboxrd@z Thu Jan 1 00:00:00 1970 From: Haavard Skinnemoen Date: Fri, 25 Jul 2008 11:16:10 +0200 Subject: [U-Boot-Users] Changing u-boot relocation scheme In-Reply-To: <1216919540.27201.56.camel@localhost.localdomain> References: <20080724130105.3EE93248B9@gemini.denx.de> <1216905458.27201.38.camel@localhost.localdomain> <20080724185734.6d79c419@hskinnemo-gx745.norway.atmel.com> <1216919540.27201.56.camel@localhost.localdomain> Message-ID: <20080725111610.3a9e7312@siona.local> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, 24 Jul 2008 19:12:20 +0200 Kenneth Johansson 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