[LLVMdev] Transparent LTO on Mac OS X
criswell at uiuc.edu
Fri Dec 4 14:49:12 PST 2009
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:
> 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).
Is the source code to Apple's ld linker publicly available, and if so,
in what package is it in the Mac OS X sources?
-- John T.
> Shantonu Sen
> ssen at apple.com
> Sent from my Mac Pro
> On Dec 4, 2009, at 1:57 PM, John Criswell wrote:
>> John Criswell wrote:
>>> Dear All,
>>> I'm trying to use transparent link-time optimization on Mac OS X.
>>> I've got Xcode 3.2 installed, and I'm trying to compile code with
>>> llvm-gcc -O4. However, I get the following error:
>>> gcc -O4 -o dftables .libs/dftables.o
>>> ld: warning: in .libs/dftables.o, file is not of required architecture
>>> Undefined symbols:
>>> "_main", referenced from:
>>> start in crt1.10.6.o
>>> ld: symbol(s) not found
>>> collect2: ld returned 1 exit status
>> I should add that the gcc above is a symbolic link to llvm-gcc.
>> -- John T.
>>> It seems that the linker doesn't understand the bitcode format. Am I
>>> missing a command line option? Do I need a newer version of XCode?
>>> -- John T.
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev