[cfe-dev] Using Clang -O4 with CMake

Chris Lattner clattner at apple.com
Fri Jun 18 21:15:02 PDT 2010


On Jun 18, 2010, at 8:47 PM, Clark Gaebel wrote:

> I'm running...
> 
> clark at clark-laptop ~/dev/cpp/GoGo/build $ clang++ --version
> clang version 1.5 (trunk 101682)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix

For LTO to work on linux, you need to use the gold linker and set up the gold lto plugin.  Please see:
http://llvm.org/docs/GoldPlugin.html

-Chris

> 
> On 06/18/10 23:07, Eric Christopher wrote:
>> On Jun 18, 2010, at 8:01 PM, Clark Gaebel wrote:
>> 
>> 
>>> When trying out -O4 instead of my usual -O3 on my C++ code using CMake,
>>> I got this error...
>>> 
>>> Linking CXX executable test_memory
>>> cd /home/clark/dev/cpp/GoGo/build/util/test && /usr/bin/cmake -E
>>> cmake_link_script CMakeFiles/test_memory.dir/link.txt --verbose=1
>>> /usr/local/bin/clang++     
>>> CMakeFiles/test_memory.dir/test_memory.cpp.o  -o test_memory -rdynamic
>>> -lboost_filesystem-mt-1_42 -lboost_iostreams-mt-1_42
>>> -lboost_program_options-mt-1_42 -lboost_regex-mt-1_42
>>> -lboost_serialization-mt-1_42 -lboost_signals-mt-1_42
>>> -lboost_thread-mt-1_42 -lboost_wave-mt-1_42
>>> CMakeFiles/test_memory.dir/test_memory.cpp.o: file not recognized: File
>>> format not recognized
>>> collect2: ld returned 1 exit status
>>> 
>>> What am I doing wrong? This works fine on every other optimization
>>> setting. Literally, the only thing I did differently was -O4 instead of -O3.
>>> 
>> O4 means use lto.  What platform are you on? Does it support llvm lto? :)
>> 
>> And I have no idea if the cmake files are set up for that either.
>> 
>> -eric
> 
> -- 
> Regards,
> -Clark
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list