BUILD_SHARED_LIBS build

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Nov 5 09:41:16 PST 2014


> The reduced testcase is attached. Build it with
>
> gcc test3.c -fPIC -shared -o test3.so
> gcc test2.c -fPIC -shared -o test2.so test3.so
> gcc test.c -o test test2.so -fuse-ld=gold # works
> gcc test.c -o test test2.so -fuse-ld=bfd #fails
>
> Maybe we should just require a non-broken linker for BUILD_SHARED_LIBS?

Good news is that bfd ld has a command line option to enable the sane
behavior, so we should be able to just use the attached patch. With it
we get fewer bogus dependencies. For example, we go from

build lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/AggressiveAntiDepBreaker.cpp.o:
CXX_COMPILER /home/espindola/llvm/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
|| include/llvm/IR/intrinsics_gen lib/libLLVMSupport.so
lib/libLLVMCore.so lib/libLLVMBitReader.so
lib/libLLVMTransformUtils.so lib/libLLVMInstCombine.so
lib/libLLVMScalarOpts.so lib/libLLVMipa.so lib/libLLVMAnalysis.so
lib/libLLVMMCParser.so lib/libLLVMMC.so lib/libLLVMObject.so
lib/libLLVMTarget.so lib/libLLVMProfileData.so

to

build lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/AggressiveAntiDepBreaker.cpp.o:
CXX_COMPILER /home/espindola/llvm/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
|| include/llvm/IR/intrinsics_gen lib/libLLVMSupport.so
lib/libLLVMCore.so lib/libLLVMTransformUtils.so
lib/libLLVMScalarOpts.so lib/libLLVMAnalysis.so lib/libLLVMMC.so
lib/libLLVMTarget.so

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141105/d1c09a8f/attachment.bin>


More information about the llvm-commits mailing list