[PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

Logan Chien via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 04:05:23 PDT 2016

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.


More information about the cfe-commits mailing list