[PATCH] [lld][ELF] Add explictly exported atoms and export R_*_COPY'ed atoms.

kledzik at apple.com kledzik at apple.com
Tue Oct 1 13:23:38 PDT 2013

  Sounds like this is all about for the ELF writer whether a atom's name should be added to the dynamic symbol table (. dynsym) or not.

  Mach-o does not have a dynamic symbol table.  Instead, the symbol table is sorted into three regions: locals, globals, and undefines.  The dynamic loader only looks at the last two regions.  The mach-o linker puts scopeTranslationUnit and scopeLinkageUnit into the locals region.

  Seems like that should work for ELF too.  Unless you also want to make the optimization that for main executables you add nothing to the dynamic symbol table (except undefines). But, then you have the problem that there won't be a symbol for the data that you want the COPY relocation to refer to.  So, Michael's patch is to add an attribute to override and keep that data symbol name in the dynamic symbol table.

  Assuming my understanding above is correct, then having a side table of "extra symbols for dynamic symbol table" seems fine.  Regarding the problem of const LinkingContext, I thought we decided months ago when it was renamed that the goal was to remove the const on its usages so it could be modified during the link.

  Regarding the problem replacing SharedLibraryAtom x with the ObjectAtom, you can do that in an Pass.  You just need to walk all atoms and references to find references to the old atom and update those references to point to the new atom.


More information about the llvm-commits mailing list