[LLVMdev] Transparent LTO on Mac OS X

Chris Lattner clattner at apple.com
Fri Dec 4 15:18:35 PST 2009


On Dec 4, 2009, at 2:49 PM, John Criswell wrote:
>> If you are building llvm-gcc yourself, try, in this order:
>> 1) sudo ln -s ../../Developer/usr/lib/libLTO.dylib /usr/lib/ 
>> libLTO.dylib
>>
>> 2) If you still get errors, try installing the libLTO.dylib from  
>> your LLVM build into /Developer/usr/lib. Make sure that if you're  
>> on a 64-bit machine, you built llvm for x86_64-apple-darwin10  
>> (which should be the default)
>>
> The problem I'm going to have (now that LTO works) is that I want to
> replace libLTO.dylib with my own (I'm trying to do transparent
> whole-program analysis within libLTO).  My libLTO is going to generate
> bitcode that /Developer/usr/bin/ld (probably) won't understand because
> the format seems to be newer (LLVM 2.6).

'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.

-Chris



More information about the llvm-dev mailing list