[LLVMdev] Transparent LTO on Mac OS X

Devang Patel devang.patel at gmail.com
Fri Dec 4 15:16:56 PST 2009

Hi John,

On Fri, Dec 4, 2009 at 2:49 PM, John Criswell <criswell at uiuc.edu> wrote:
> Shantonu Sen wrote:
>> Are you building llvm-gcc yourself? If so, what version?
>> Xcode releases include an older llvm-gcc and libLTO.dylib, which may not understand bitcode generated by newer self-built compilers.
> Thanks.  A bitcode format mismatch was the problem.  I'm not sure if the
> problem stems from the fact that the bitcode was generated for the wrong
> architecture (32 vs. 64 bit) or if the bitcode format changed during the
> development of LLVM 2.6 (I'm using the LLVM 2.6 release, while XCode 3.2
> seems to be using some version of LLVM in-between LLVM 2.5 and LLVM 2.6).
>> If you are only using llvm-gcc from the Xcode tools release, use the driver from:
>> /Developer/usr/bin/llvm-gcc-4.2
>> 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).

Why not use llmv-ld tool instead of ld for your needs ?

More information about the llvm-dev mailing list