[MacPorts] #33207: clang-3.1 LTO broken
#33207: clang-3.1 LTO broken --------------------------------+------------------------------------------- Reporter: mmoll@… | Owner: jeremyhu@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: llvm clang LTO | Port: clang-3.1 --------------------------------+------------------------------------------- Take the following minimal program called, say, test.cpp: {{{ int main(int,char**) { return 0; } }}} and compile it with -O4. This is what I see: {{{ clang++-mp-3.1 -O4 test.cpp -o test -v clang version 3.1 (trunk 149973) Target: x86_64-apple-darwin11.3.0 Thread model: posix "/opt/local/libexec/llvm-3.1/bin/clang" -cc1 -triple x86_64-apple- macosx10.7.0 -emit-llvm-bc -disable-free -main-file-name test.cpp -pic- level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 127.2 -v -resource-dir /opt/local/libexec/llvm-3.1/bin/../lib/clang/3.1 -fmodule-cache-path /var/folders/5x/k48hkr0n2mx5qz3_0xw516800000gn/T/clang-module-cache -I /opt/local/include -O3 -fdeprecated-macro -fdebug-compilation-dir /Users/mmoll/omplapp/build/Release -ferror-limit 19 -fmessage-length 97 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime-has-arc -fobjc- runtime-has-weak -fobjc-dispatch-method=mixed -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/5x/k48hkr0n2mx5qz3_0xw516800000gn/T/test-HHZUrL.o -x c++ test.cpp clang -cc1 version 3.1 based upon LLVM 3.1svn default target x86_64-apple- darwin11.3.0 ignoring nonexistent directory "/usr/include/c++/4.2.1/i686-apple- darwin10/x86_64" ignoring nonexistent directory "/usr/include/c++/4.0.0" ignoring nonexistent directory "/usr/include/c++/4.0.0/i686-apple- darwin8/" ignoring nonexistent directory "/usr/include/c++/4.0.0/backward" #include "..." search starts here: #include <...> search starts here: /opt/local/include /usr/include/c++/4.2.1 /usr/include/c++/4.2.1/backward /usr/local/include /opt/local/libexec/llvm-3.1/bin/../lib/clang/3.1/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. "/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld" -demangle -object_path_lto /var/folders/5x/k48hkr0n2mx5qz3_0xw516800000gn/T/cc- bK5Nhp.o -dynamic -arch x86_64 -macosx_version_min 10.7.0 -o test -lcrt1.10.6.o /var/folders/5x/k48hkr0n2mx5qz3_0xw516800000gn/T/test- HHZUrL.o -lstdc++ -lSystem ld: in /var/folders/5x/k48hkr0n2mx5qz3_0xw516800000gn/T/test-HHZUrL.o, could not parse object file /var/folders/5x/k48hkr0n2mx5qz3_0xw516800000gn/T/test-HHZUrL.o: Invalid MODULE_CODE_FUNCTION record for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) }}} If I explicitly use the LLVM linker I get an executable that can't be run: {{{
clang++-mp-3.1 -O4 test.cpp -o test.o -c llvm-ld-mp-3.1 -o test test.o -lstdc++ -lSystem ./test ./test: line 3: exec: lli: not found }}}
-- Ticket URL: <https://trac.macports.org/ticket/33207> MacPorts <http://www.macports.org/> Ports system for Mac OS
#33207: clang-3.1 LTO broken --------------------------------+------------------------------------------- Reporter: mmoll@… | Owner: jeremyhu@… Type: defect | Status: assigned Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: llvm clang LTO | Port: clang-3.1 --------------------------------+------------------------------------------- Changes (by jeremyhu@…): * status: new => assigned Comment: I can't reproduce this here because my ld does support LTO. The second issue is just because you haven't done 'port select llvm', so lli isn't in your $PATH. You can work around that bug with: LLVMINTERP=lli-mp-3.1 ./test -- Ticket URL: <https://trac.macports.org/ticket/33207#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#33207: clang-3.1 LTO broken --------------------------------+------------------------------------------- Reporter: mmoll@… | Owner: jeremyhu@… Type: defect | Status: assigned Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: llvm clang LTO | Port: clang-3.1 --------------------------------+------------------------------------------- Comment(by jeremyhu@…): LLVMINTERP was fixed with r91154 r91155 -- Ticket URL: <https://trac.macports.org/ticket/33207#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#33207: clang LTO doesn't work with older ld64 --------------------------------+------------------------------------------- Reporter: mmoll@… | Owner: jeremyhu@… Type: defect | Status: assigned Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: llvm clang LTO | Port: clang-3.1 --------------------------------+------------------------------------------- -- Ticket URL: <https://trac.macports.org/ticket/33207#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#33207: clang LTO doesn't work with older ld64 --------------------------------+------------------------------------------- Reporter: mmoll@… | Owner: jeremyhu@… Type: defect | Status: assigned Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: llvm clang LTO | Port: clang-3.1 --------------------------------+------------------------------------------- Comment(by jeremyhu@…): When linking, ld64 needs to find our libLTO: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-September/017145.html -- Ticket URL: <https://trac.macports.org/ticket/33207#comment:4> MacPorts <http://www.macports.org/> Ports system for Mac OS
#33207: clang LTO doesn't work with older ld64 --------------------------------+------------------------------------------- Reporter: mmoll@… | Owner: jeremyhu@… Type: defect | Status: assigned Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: llvm clang LTO | Port: clang-3.1 --------------------------------+------------------------------------------- Comment(by jeremyhu@…): I can reproduce it by forcing an old libLTO into /usr/lib: {{{ sudo mv /usr/lib/libLTO.dylib /usr/lib/libLTO.dylib.bak sudo cp /opt/local/libexec/llvm-2.9/lib/libLTO.dylib /usr/lib clang++-mp-3.1 -O4 test.cpp -c /usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.7.0 -o test -lcrt1.10.6.o test.o -lstdc++ -lSystem /opt/local/libexec/llvm-3.1/bin/../lib/clang/3.1/lib/darwin/libclang_rt.osx.a }}} And I can work around it in either of these ways: {{{ DYLD_LIBRARY_PATH=/opt/local/libexec/llvm-3.1/lib /usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.7.0 -o test -lcrt1.10.6.o test.o -lstdc++ -lSystem /opt/local/libexec/llvm-3.1/bin/../lib/clang/3.1/lib/darwin/libclang_rt.osx.a }}} {{{ cd /opt/local/libexec/llvm-3.0/bin sudo ln -s /usr/bin/ld ... /opt/local/libexec/llvm-3.1/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.7.0 -o test -lcrt1.10.6.o test.o -lstdc++ -lSystem /opt/local/libexec/llvm-3.1/bin/../lib/clang/3.1/lib/darwin/libclang_rt.osx.a }}} -- Ticket URL: <https://trac.macports.org/ticket/33207#comment:5> MacPorts <http://www.macports.org/> Ports system for Mac OS
#33207: clang LTO doesn't work with older ld64 ---------------------------------+------------------------------------------ Reporter: mmoll@… | Owner: jeremyhu@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Resolution: fixed | Keywords: llvm clang LTO Port: clang-3.1 | ---------------------------------+------------------------------------------ Changes (by jeremyhu@…): * status: assigned => closed * resolution: => fixed Comment: r91168 -- Ticket URL: <https://trac.macports.org/ticket/33207#comment:6> MacPorts <http://www.macports.org/> Ports system for Mac OS
participants (1)
-
MacPorts