[cfe-dev] Using Clang -O4 with CMake
Toralf Niebuhr
niebuhr at niebuhrt.de
Sat Jun 19 23:23:24 PDT 2010
Am 19.06.2010 um 15:20 schrieb Paul Davey:
> On Sat, Jun 19, 2010 at 10:39 PM, Toralf Niebuhr <niebuhr at niebuhrt.de> wrote:
>>
>> Am 19.06.2010 um 06:15 schrieb Chris Lattner:
>>
>>>
>>> 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
>> I had the same problem too. Is there such a plugin for Mac OS X too?
>
> The darwin linker understands llvm bitcode files and can link them AFAIK...
> =
This is my problem with -O4
Compiling with -O3 compiles fine.
compiling this with
clang++ -O4 -o test test.cpp
int main() {
return 0;
}
compiles fine on Mac OS X
As sonn as I include system headers, the compilation breaks.
clang++ -O4 -o test test.cpp
#include <iostream>
int main() {
return 0;
}
Operand is null
%0 = tail call i32 @__cxa_atexit(void (i8*)* bitcast (void (%"class.std::ios_base::Init"*)* @_ZNSt8ios_base4InitD1Ev to void (i8*)*), <null operand!>, i8* bitcast (i8** @__dso_handle to i8*)) ; <i32> [#uses=0]
Broken module found, compilation aborted!
Stack dump:
0. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
1. Running pass 'Module Verifier' on function '@_GLOBAL__I_a'
Is this a different problem?
For details:
Target: x86_64-apple-darwin10
Thread model: posix
"/Users/gmthor85/llvm/llvm/Release/bin/clang" -cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm-bc -disable-free -main-file-name test.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -v -resource-dir /Users/gmthor85/llvm/llvm/Release/lib/clang/2.0 -O3 -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -fblocks -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/3C/3Cjb8XqLGZ4CudBSDgvEJE+++TI/-Tmp-/cc-8KSeTq.o -x c++ test.cpp
clang -cc1 version 2.0 based upon llvm 2.8svn hosted on x86_64-apple-darwin10
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.2.1
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64
/usr/include/c++/4.2.1/backward
/usr/include/c++/4.0.0
/usr/include/c++/4.0.0/i686-apple-darwin8
/usr/include/c++/4.0.0/backward
/usr/local/include
/Users/gmthor85/llvm/llvm/Release/lib/clang/2.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld" -dynamic -arch x86_64 -macosx_version_min 10.6.0 -o test -lcrt1.10.6.o -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/Users/gmthor85/llvm/llvm/Release/bin/../lib -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/folders/3C/3Cjb8XqLGZ4CudBSDgvEJE+++TI/-Tmp-/cc-8KSeTq.o -lstdc++ -lSystem -lgcc
Operand is null
%0 = tail call i32 @__cxa_atexit(void (i8*)* bitcast (void (%"class.std::ios_base::Init"*)* @_ZNSt8ios_base4InitD1Ev to void (i8*)*), <null operand!>, i8* bitcast (i8** @__dso_handle to i8*)) ; <i32> [#uses=0]
Broken module found, compilation aborted!
Stack dump:
0. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
1. Running pass 'Module Verifier' on function '@_GLOBAL__I_a'
>
> _______________________________________________
> 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