[llvm-commits] patch to llvm-link to link in archives
Stephen Checkoway
s at pahtak.org
Mon Jul 30 12:04:20 PDT 2012
Hi,
The attached patch to llvm-link enables linking in bitcode archives. It also adds support for archives specified via -L and -l flags as well as the standard ld options -Bstatic and -Bdynamic so that if libfoo.a and libfoo.so exist in a directory and -Bstatic -lfoo is passed to llvm-link, libfoo.a will be linked in and if -Bdynamic -lfoo is passed, then nothing will be linked in.
While implementing the library search functionality, I ended up duplicating and rearranging the code in Linker::FindLib() because that offered no way to prefer dynamic libraries/require static libraries. I did not include checking for libfoo (no extension) as is done starting on line 143 of lib/Linker/Linker.cpp because I didn't understand what that particular code is trying to do and I couldn't square the comment with the code. Namely, I don't see how checking if /some/path/libfoo exists lets you link to a specific .so version like libfoo.so.1.0.0.
There's also a test that linking in an archive only pulls in objects required to resolve symbols.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linkarchive.ll
Type: application/octet-stream
Size: 450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120730/e267d729/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-link.cpp.diff
Type: application/octet-stream
Size: 10323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120730/e267d729/attachment-0001.obj>
-------------- next part --------------
--
Stephen Checkoway
More information about the llvm-commits
mailing list