From: Wolfgang Denk Date: Mon, 04 Oct 2010 19:06:14 +0200 Subject: [U-Boot] ARM relocation, question to Heiko In-Reply-To: <4CA9F294.8080007@comcast.net> References: <4CA49746.2050301@emk-elektronik.de> <4CA57762.3000201@denx.de> <4CA5821E.3070108@emk-elektronik.de> <4CA5873B.6040907@free.fr> <4CA590E6.6070701@emk-elektronik.de> <4CA59B89.6090207@denx.de> <4CA5BB7A.8050304@emk-elektronik.de> <20101001105506.A64D41539A0@gemini.denx.de> <4CA5BFEF.3090208@emk-elektronik.de> <20101001112125.4076E153A7E@gemini.denx.de> <4CA5C7DE.6010300@emk-elektronik.de> <20101001115908.A34411539A0@gemini.denx.de> <4CA5D26D.2090505@emk-elektronik.de> <4CA5D857.5010009@emk-elektronik.de> <20101001125502.D0B4E1539A0@gemini.denx.de> <4CA6DC16.5040409@emk-elektronik.de> <4CA6E517.9040701@fr <1286167382.22760.19.camel@ptyser-laptop> <4CA99141.5020104@free.fr> <4CA999EE.5030309@free.fr> <20101004101308.94E27153A7E@gemini.denx.de> <4CA9F294.8080007@comcast.net> Message-ID: <20101004170614.6CFAA1539A0@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear "J. William Campbell", In message <4CA9F294.8080007@comcast.net> you wrote: > > Yes, I think Wolfgang is correct. This is not going to be easy to do in > general. To run anywhere, the code must be true Position Independent > code. If you intend to use any C code in the initialization, this will > result in needing -fPIC for at least that code. I am not sure you can > mix -fPIC and non -fPIC code in the same link, but I expect not. I am a > bit surprised that it is possible to get even the initialization code to > be Position Independent, but it appears that on at least some PPC it is > possible/has been done. Not really. On PowerPC, only the first 20 or 30 lines of assembler code in start.S are position independent; then we compute the link (resp. execution) address and branch to it. From then, we run from the very address range we were linked for (starting at TEXT_BASE). > Albert is doing now, and Graeme did before, is the first option, > creating a loader that understands ELF. This has the advantage that it > will work on all architectures. However, once this understanding is in > place, it would be easy to write a small post-processing program that > would reduce the size of the relocation entries, much like -mrelocatable > does. This may or may not be necessary, but it is certainly possible. Eventually we might even add -mrelocatable support for the other architectures to the tool chain. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Its always easier short term to pee in the pond than install a toilet - it's just not a good long term plan. - Alan Cox in <20100101145701.6432e7b7@lxorguk.ukuu.org.uk>