[LLVMdev] Question about linking modules with weak symbols
daniel.liew at imperial.ac.uk
Wed Jan 22 16:19:57 PST 2014
I have the need to re-implement linking archives containg bitcode
modules built by the current llvm-ar tool. In built support for this
was removed in LLVM3.3 so I decided to take a look at how it was
implemented for inspiration.
Of particular interest is Linker::LinkInArchives() and GetAllUndefined
Symbols in lib/Linker/LinkArchive.cpp . Although this code has long
been dead and some of the APIs that these functions used are gone the
principles of the algorithm are still relevant which is what I'm
There doesn't seem to be any mention of weak symbols in
Linker::LinkArchives() and I don't understand why.
For example if you had a Module that had a function foo() defined but
it was defined as a weak symbol then when linking with an archive is
done, I expect the algorithm would want to look for modules in that
archive that also define foo but aren't weak (i.e. strong symbols) to
link in to build the composite module. Is this case covered by the
algorithm and I've missed something?
More information about the llvm-dev