Date: Mon, 4 Apr 2016 16:56:42 +1000 From: Patrick Oppenlander <pattyo.lists@...il.com> To: musl@...ts.openwall.com Subject: Re: vfork on ARM On 04/04/16 13:37, Rich Felker wrote: > PIE does not hard-code a load address (the loader can pick the load > address, and could match it to ROM) but the relative offset between > load segments (the read-only text and read-write data) is fixed at > ld-time as usual for ELF. This certainly precludes using the text > in-place if there can be more than once instance executing (since they > can't both have their data at the same offset from text) and makes it > difficult to even run one instance in-place (only possible if you can > arrange for free RAM to exist at the right fixed offset. If you really > wanted to hack up such a setup, you would want non-PIE ELF files where > you pick the absolute addresses for load segments, not PIE where you > can only pick the relative address. I see the problem in my understanding. I had assumed that for a PIC executable the GOT was always accessed through a register rather than linked at a fixed location. In my testing this only happens for ARM under gcc with a combination of "-fpic -msingle-pic-base -mno-pic-data-is-text-relative". Then r9 is used to hold the GOT location and needs to be initialised by the program loader. That might be enough to be able to XIP on arm for static executables. I think I have some issues with my compiler flags or link script. -fpie is generating identical code to -fpic and the resultant ELF is still flagged EXEC_P rather than DYNAMIC. > I'm not sure what you mean by relocatable code here. I was talking about linking with the --relocatable option to ld then processing the relocations at program load time. This is how the project I forked from works. The result is still a complete copy of text/data for each process. Also, thank you for taking the time to discuss this now off-topic topic. Patrick
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.