compiler-rt only builds x86 sanitizers by default

Hi All, I looked into the configure and cmake files, it seems compiler-rt only target x86 by default. It is determined by COMPILER_RT_DEFAULT_TARGET_ARCH, which is coming from host TARGET triple.

Can anyone tell me why? Why not do the same as Clang is doing to build for all targets by default.

Also, if I want to make it to build for all targets by default, what’s the best way to change it.

This is a complicated problem, and it doesn’t have an easy solution.

The problem is CMake generally assumes that you’re building for one target at a time, which is a safe assumption for most projects, but doesn’t work great when you’re building a cross-compiler. The correct solution to this will be to extend the LLVM_BUILD_EXTERNAL_COMPILER_RT option to take a list of target specifiers (or triples) and configure and build compiler-rt n times.

I have plans to work on that support sometime hopefully in the next few months. Overhauling the LLVM_BUILD_EXTERNAL_COMPILER_RT option is basically the next logical step after I finish my work on the builtin libraries (See: