[llvm] [cmake] LLVM_BUILTINS_TARGET='default' should bootstrap builtins without compiler-rt (PR #171536)

Andrew Haberlandt via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 15:49:08 PST 2025


https://github.com/ndrewh created https://github.com/llvm/llvm-project/pull/171536

This makes it possible to build just clang + builtins with:

```
LLVM_ENABLE_PROJECTS="clang"
LLVM_BUILTIN_TARGETS="default"
```



>From 1a664bef29e5daa7bc1d242277e52e8f71b0b021 Mon Sep 17 00:00:00 2001
From: Andrew Haberlandt <ahaberlandt at apple.com>
Date: Tue, 9 Dec 2025 15:44:27 -0800
Subject: [PATCH] LLVM_BUILTINS_TARGET='default' should bootstrap builtins even
 w/o compiler-rt

---
 llvm/runtimes/CMakeLists.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 7f8f239efbe68..babf94e430abb 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -34,6 +34,13 @@ function(get_compiler_rt_path path)
       return()
     endif()
   endforeach()
+
+  # If LLVM_BUILTIN_TARGETS is spcified, we still need
+  # to locate the compiler-rt runtime to be able to build builtins.
+  # This supports bootstrapping builtins without compiler-rt.
+  if (LLVM_BUILTIN_TARGETS)
+    set(${path} "${CMAKE_CURRENT_SOURCE_DIR}/../../compiler-rt" PARENT_SCOPE)
+  endif()
 endfunction()
 
 include(LLVMExternalProjectUtils)



More information about the llvm-commits mailing list