From 4c7c0fbfc6a6cf1916d7cd3ddc25454edd975c76 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 5 May 2026 04:38:17 +0900 Subject: [PATCH] internal/rosa/llvm: update configuration for early runtimes These were never updated when the bootstrap was moved to stage0-only. Signed-off-by: Ophestra --- internal/rosa/llvm.go | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go index c7d094ad..121b2fbe 100644 --- a/internal/rosa/llvm.go +++ b/internal/rosa/llvm.go @@ -39,16 +39,23 @@ func (t Toolchain) newEarlyCompilerRT() (pkg.Artifact, string) { Append: []string{"compiler-rt"}, Cache: []KV{ + {"ENABLE_LINKER_BUILD_ID", "ON"}, + // libc++ not yet available {"CMAKE_CXX_COMPILER_TARGET", ""}, {"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`}, {"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`}, + {"LLVM_ENABLE_RTTI", "ON"}, + {"LLVM_BUILD_LLVM_DYLIB", "ON"}, + {"LLVM_LINK_LLVM_DYLIB", "ON"}, {"LLVM_ENABLE_PER_TARGET_RUNTIME_DIR", "ON"}, {"COMPILER_RT_BUILD_BUILTINS", "ON"}, - {"COMPILER_RT_DEFAULT_TARGET_ONLY", "OFF"}, + {"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"}, + {"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"}, {"COMPILER_RT_SANITIZERS_TO_BUILD", "asan"}, + {"COMPILER_RT_BUILD_GWP_ASAN", "OFF"}, // does not work without libunwind {"COMPILER_RT_BUILD_CTX_PROFILE", "OFF"}, @@ -99,19 +106,29 @@ func (t Toolchain) newEarlyRuntimes() (pkg.Artifact, string) { Append: []string{"runtimes"}, Cache: []KV{ + {"ENABLE_LINKER_BUILD_ID", "ON"}, + // libc++ not yet available {"CMAKE_CXX_COMPILER_WORKS", "ON"}, {"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`}, {"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`}, + {"LLVM_ENABLE_RTTI", "ON"}, + {"LLVM_BUILD_LLVM_DYLIB", "ON"}, + {"LLVM_LINK_LLVM_DYLIB", "ON"}, {"LLVM_ENABLE_RUNTIMES", "'libunwind;libcxx;libcxxabi'"}, + {"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"}, {"LIBUNWIND_USE_COMPILER_RT", "ON"}, {"LIBCXX_HAS_MUSL_LIBC", "ON"}, {"LIBCXX_USE_COMPILER_RT", "ON"}, + {"LIBCXX_CXX_ABI", "libcxxabi"}, + {"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"}, + {"LIBCXX_HARDENING_MODE", "fast"}, {"LIBCXX_HAS_ATOMIC_LIB", "OFF"}, {"LIBCXXABI_USE_COMPILER_RT", "ON"}, {"LIBCXXABI_USE_LLVM_UNWINDER", "ON"}, + {"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"}, {"LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL", "OFF"}, {"LLVM_ENABLE_ZLIB", "FORCE_ON"}, @@ -144,11 +161,11 @@ func init() { func (t Toolchain) newLLVM() (pkg.Artifact, string) { var early PArtifact = muslHeaders if t.isStage0() { - // The LLVM build system is buggy around LLVM_LINK_LLVM_DYLIB and leaks - // the system installation when invoking the newly built toolchain. This - // is worked around in stage0 by providing standalone builds of - // runtimes. Later stages rely on 3-stage determinism and allows the - // system installation from its previous stage to leak through. + // The LLVM build system uses the system installation when building with + // LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using + // the just-built toolchain. This is unacceptable in stage0 due to the + // potential version difference. Later stages bootstrap off of runtimes + // of its previous stage via 3-stage determinism. early = earlyRuntimes }