[LLVMdev] [lld] ELF needs type for SharedLibraryAtom.

Nick Kledzik kledzik at apple.com
Tue Sep 24 11:16:28 PDT 2013

On Sep 24, 2013, at 9:13 AM, Joerg Sonnenberger wrote:

> On Tue, Sep 24, 2013 at 10:49:36AM -0500, Shankar Easwaran wrote:
>> Not sure why this is being done for a long time with the GNU linker.
> Because the main program is not PIC, it will only use absolute
> references to global symbols. For functions, you can create a PLT
> record, but for data access, you have to hide the real symbol and copy
> the content over to the equivalent in the main binary.

On Darwin, non-PIC programs use runtime text-relocations.  The loader modifies the instructions (which are referencing absolute addresses) to reference the right runtime address (in some shared library).

How can copying data work?  If a program references data in a shared library, and you copy the data into the program, you now have two copies of the data and their content can diverge.  

Is this "missing-copy-relocation" a build time or runtime relocation?  That is, does the static linker copy the data content? or the runtime loader (ld.so)?


More information about the llvm-dev mailing list