[PATCH] Fix Weak External symbol handling.

Shankar Kalpathi Easwaran shankarke at gmail.com
Tue Nov 19 08:41:29 PST 2013


  I still think that this is being called too early. I thought the fallback atom would only be used as a target for resolution only if the original undefined symbol stays as undefined. With the current approach I dont think its fixed.

  Consider object files mixed with multiple archive files and shared libraries. The undefined atom would be only picked up after only looking up the archive library. It makes it more harder as soon as you see a mix of shared libraries and archive libraries which define the symbol too.

  This is the extract that I read from, I am sure you already know this, I am only mentioning this for the purpose of discussion.

  <--------------------snip--------------------------->

  “Weak externals” are a mechanism for object files that allows flexibility at link time.

  A module can contain an unresolved external symbol (sym1), but it can also include an auxiliary record that indicates that if sym1 is not present at link time, another external symbol (sym2) is used to resolve references instead.

  If a definition of sym1 is linked, then an external reference to the symbol is resolved normally. If a definition of sym1 is not linked, then all references to the weak external for sym1 refer to sym2 instead. The external symbol, sym2, must always be linked; typically, it is defined in the module that contains the weak reference to sym1.

  <--------------------snip--------------------------->

http://llvm-reviews.chandlerc.com/D2162



More information about the llvm-commits mailing list