logan added a comment.

Hi @rengolin and @EricWF,

After tracing the commit log of clang, it seems that `--rtlib=` is ignored 
intentionally when `-nodefaultlibs` is present.  (see also: 
https://reviews.llvm.org/rL254535)

And, unfortunately, we don't have a command line option to ask clang to link 
compiler-rt built-in library along (regardless the `-nodefaultlibs` option.)

One solution might be adding the `libclang_rt.builtins.${arch}.a` detection 
rules[1] to CMakeLists.txt, and manually specify 
`-lclang_rt.builtins-${arch}.a` when `LIBCXXABI_USE_COMPILER_RT` is enabled.  
How do you think about this solution?

[1] There is a function named `ToolChain::getCompilerRT()` in 
`${clang}/lib/Driver/ToolChain.cpp` which is responsible to detect and pick the 
correct compiler-rt library.


https://reviews.llvm.org/D24083



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to