[LLVMdev] Transparent LTO on Mac OS X

Dan Villiom Podlaski Christiansen danchr at gmail.com
Sat Dec 5 06:01:00 PST 2009


On 5 Dec 2009, at 00:18, Chris Lattner wrote:

> 'ld' doesn't know anything about the bitcode format.  If you replace  
> liblto with something from mainline, then 'ld' will understand  
> mainline LLVM .bc files.
> 
> Note that the linker looks relative to itself.  This means that if you  
> want to use /usr/bin/ld that you need to install liblto in /usr/lib.   
> If you want to use /Developer/usr/bin/ld you need to update /Developer/ 
> usr/lib.

In my experience, the easiest way is to set DYLD_LIBRARY_PATH before invoking ‘ld’. You can do this in a small shell script, put in the relevant ‘…/libexec/gcc/…’ directory also containing ‘cc1’ and so on. For example:

> #!/bin/sh
> export DYLD_LIBRARY_PATH=/opt/llvm/lib
> exec /usr/bin/ld "$@"

Unfortunately, this won't work with other tools in Snow Leopard, such as ‘nm’ and ‘ar’. They have the search path hard coded:

> $ strings =nm | grep LTO
> ../lib/libLTO.dylib
> /Developer/usr/lib/libLTO.dylib

--

Dan Villiom Podlaski Christiansen
danchr at gmail.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091205/2565913f/attachment.bin>


More information about the llvm-dev mailing list