[compiler-rt] [compiler-rt] allow removing libc dependency on Android (PR #152394)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 16:34:37 PDT 2025


https://github.com/efriedma-quic commented:

> > The upside is that we have an initial compiler-rt without a dependency to libc, which is useful for building Bionic libc.
> 
> as the main bionic maintainer for the last 10+ years, this is the bit i don't get --- bionic builds just fine :-)

To build a cross-compile toolchain from scratch, you usually install libc headers, then build compiler-rt.builtins, then build the complete libc, then build whatever else you need.

The NixOS developers weren't aware of this, or didn't like it, so they came up with a different way to build libc.  First, build a subset of compiler-rt.builtins with COMPILER_RT_BAREMETAL_BUILD.  Then build libc.  Then build compiler-rt.builtins.

I don't think we want to endorse using builtins built with COMPILER_RT_BAREMETAL_BUILD on a non-baremetal platform; it has other side-effects that are potentially problematic.

We could maybe consider adding a new dedicated CMake flag for this purpose... but the NixOS approach doesn't really seem like an improvement over just doing what everyone else does.

https://github.com/llvm/llvm-project/pull/152394


More information about the llvm-commits mailing list