[cfe-dev] How to link against compiler-rt instead of libgcc by default

Lei Zhang via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 1 23:57:52 PDT 2016


Hi,

I'm trying to make clang work with musl-libc and LLVM's C++ runtime
stack (libc++, libc++abi, libunwind & compiler-rt) on Linux. Ideally
executables built by this clang should have zero dependency on GCC or
glibc.

There's just one part that stops me: on Linux, clang always link
executables against libgcc. Though this could be circumvented with
option "-rtlib=compiler-rt", I wish clang could work just out the box.

So, is it possible to add a cmake option to enforce the use of
compiler-rt at build time, just like the existing option
"CLANG_DEFAULT_CXX_STDLIB"?

Alternatively, the decision could be made at runtime by checking the
triplet. But a vanilla triplet like "x86_64-linux-musl" is
insufficient; we need a new vendor type, making the triplet look like
"x86_64-no_gnu-linux-musl" or "x86_64-llvm-linux-musl" or something. I
just can't think up a good name for this...

Ideas?


Lei



More information about the cfe-dev mailing list