When lld-3.4 is added to the tools directory of the llvm source tree
as lld, the resulting cmake build produces a huge number of static libs and
bloats the overall package from...
-rw-r--r-- 1 root wheel 86361440 Nov 19 21:09 llvm34_3.4-0_darwin-x86_64.deb
to
-rw-r--r-- 1 root wheel 495257452 Nov 19 20:49 llvm34_3.4-0_darwin-x86_64.deb
Is this a known issue with the initial release of lld?
Jack
lld definitely shouldn’t be that big. I would expect 10MB at most. Can you check whether something weird is happening, like lld being built with debug info?
– Sean Silva
lld definitely shouldn't be that big. I would expect 10MB at most. Can you
check whether something weird is happening, like lld being built with debug
info?
-- Sean Silva
Sean,
I'm not passing...
-G "Unix Makefiles"
to cmake per the instructions at http://lld.llvm.org/getting_started.html#building-lld.
Is that still required? I am using...
cd llvm-3.4
mv ../clang-3.4 tools/clang
mv ../lld-3.4 tools/lld
mv ../compiler-rt-3.4 projects/compiler-rt
mv ../libcxx-3.4 projects/libcxx
mv ../test-suite-3.4 projects/test-suite
mv ../polly-3.4 tools/polly
mkdir build
pushd build
cmake -DLLVM_BUILD_32_BITS:BOOL=OFF -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_INSTALL_PREFIX=%p/opt/llvm-%v -DLLVM_ENABLE_ASSERTIONS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT:STRING=/ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="" ..
make
Jack
Hi Jack,
Are you packaging all the static libraries that lld produces as part of the package ?
PS : When I build on x86_64, I only get a 9M image for lld.
Thanks
Shankar Easwaran
Hi Jack,
Are you packaging all the static libraries that lld produces as part of
the package ?
PS : When I build on x86_64, I only get a 9M image for lld.
Thanks
Shankar Easwaran
Shankar,
I think I found the problem. Apparentally I was passing too many flags to
CMAKE_CXX_FLAGS. The following reduced cmake invocation works fine...
cmake -DLLVM_BUILD_32_BITS:BOOL=OFF -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_INSTALL_PREFIX=%p/opt/llvm-%v -DLLVM_ENABLE_ASSERTIONS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT:STRING=/ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="" -DCMAKE_CXX_FLAGS:STRING=-std=c++0x ..
Now the package size is normal again...
-rw-r--r-- 1 root wheel 85591978 Nov 20 12:15 llvm34_3.4-0_darwin-x86_64.deb
I am still unclear however on how to wire the llvm/compiler-rt/clang/polly/test-suite/lld build up
for clang to default to using the new lld linker. Normally we install a symlink at
/sw/opt/llvm-3.4/bin/ld point to /usr/bin/ld.
% /sw/opt/llvm-3.4/bin/clang++ -v hello.cc
clang version 3.4 (branches/release_34)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
"/sw/opt/llvm-3.4/bin/clang-3.4" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name hello.cc -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -v -resource-dir /sw/opt/llvm-3.4/bin/../lib/clang/3.4 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/howarth -ferror-limit 19 -fmessage-length 172 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/sp/w18sshgj1b3f84306wt32xd40000gn/T/hello-9d5a89.o -x c++ hello.cc
clang -cc1 version 3.4 based upon LLVM 3.4svn default target x86_64-apple-darwin13.0.0
ignoring nonexistent directory "/usr/include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/sw/opt/llvm-3.4/bin/../include/c++/v1
/sw/opt/llvm-3.4/bin/../lib/clang/3.4/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/sw/opt/llvm-3.4/bin/ld" -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o a.out /var/folders/sp/w18sshgj1b3f84306wt32xd40000gn/T/hello-9d5a89.o -lc++ -lSystem
If I change this to symlink to point at lld...
ln -sf /sw/opt/llvm-3.4/bin/lld /sw/opt/llvm-3.4/bin/ld
the compiler fails to link...
% /sw/opt/llvm-3.4/bin/clang++ -v hello.cc
clang version 3.4 (branches/release_34)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
"/sw/opt/llvm-3.4/bin/clang-3.4" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name hello.cc -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -v -resource-dir /sw/opt/llvm-3.4/bin/../lib/clang/3.4 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/howarth -ferror-limit 19 -fmessage-length 172 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/sp/w18sshgj1b3f84306wt32xd40000gn/T/hello-f87c73.o -x c++ hello.cc
clang -cc1 version 3.4 based upon LLVM 3.4svn default target x86_64-apple-darwin13.0.0
ignoring nonexistent directory "/usr/include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/sw/opt/llvm-3.4/bin/../include/c++/v1
/sw/opt/llvm-3.4/bin/../lib/clang/3.4/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/sw/opt/llvm-3.4/bin/ld" -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o a.out /var/folders/sp/w18sshgj1b3f84306wt32xd40000gn/T/hello-f87c73.o -lc++ -lSystem
Unable to find library -lSystem
Unable to find library -lc++
Unable to find file 10.9.0
Unable to find file x86_64
Cannot open /var/folders/sp/w18sshgj1b3f84306wt32xd40000gn/T/hello-f87c73.o: Error parsing linker script
clang-3.4: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas how to default clang to the new linker?