[llvm-dev] Should the compiler-rt builtins be configured with CMAKE_TRY_COMPILE_TARGET_TYPE?

Cág via llvm-dev llvm-dev at lists.llvm.org
Sun Mar 14 12:50:49 PDT 2021


Shoaib Meenai wrote:
> https://reviews.llvm.org/D96404 landed recently to default Android
> targets to using compiler-rt instead of libgcc. Amusingly enough, it
> broke our builds of compiler-rt for Android in the runtimes build
> setup. What’s happening is that the configuration for the builtins
> for Android tests for all supported architectures [1], using
> check_symbol_exists to check for the architecture’s preprocessor
> macro [2]. check_symbol_exists tries to link a test executable,
> which fails because my just-built compiler doesn’t have compiler-rt
> yet (since it’s trying to build compiler-rt). Consequently,
> the builtins don’t think that any architectures are supported, and
> just don’t build anything as a result.

Hi all,

I've raised the topic back in November[0], and this what still works
for me (thanks to the suggestions by Martin and Chris):
1. Get the sources.
2. Build clang, llvm, lld.
3. Install libc headers to a sysroot.
4. Build compiler-rt builtins and crt with the freshly-built clang.
One need to set C_COMPILER_WORKS to skip the checks.
5. Build libc.a/libc.so

Then the script builds libc++, libc++abi, libunwind, and it results in a
working C/C++ cross-compiler.  The libc is musl, but I think this works
with any libc.  

compiler-rt C_COMPILER_WORKS checks are unnecessary because it doesn't
need itself (or any runtimes) and libc to be built.


[0]: https://lists.llvm.org/pipermail/llvm-dev/2020-November/146450.html

-- 
caóc


More information about the llvm-dev mailing list