[compiler-rt] [llvm] [Runtimes] Default build must use its own output dirs (PR #168266)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 16 04:39:49 PST 2025
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/168266
>From ce507a8441c51fa6098fc34b31e4a5ea2466f71f Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Sun, 16 Nov 2025 13:17:42 +0100
Subject: [PATCH 1/2] [Runtimes] Default build must use its own output dir
---
runtimes/CMakeLists.txt | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index b17bd8f665361..d9fcac3a646b8 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -77,11 +77,6 @@ if (NOT LLVM_FOUND)
set(LLVM_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
endif()
-# Setting these variables will allow the sub-build to put their outputs into
-# the library and bin directories of the top-level build.
-set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
-set(LLVM_RUNTIME_OUTPUT_INTDIR ${LLVM_TOOLS_BINARY_DIR})
-
# This variable makes sure that e.g. llvm-lit is found.
set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../llvm)
set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
@@ -99,6 +94,17 @@ if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSIO
set(LLVM_TREE_AVAILABLE ON)
endif()
+if(LLVM_TREE_AVAILABLE)
+ # Setting these variables will allow the sub-build to put their outputs into
+ # the library and bin directories of the top-level build.
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${LLVM_TOOLS_BINARY_DIR})
+else()
+ # Use own build directory for artifact output.
+ set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/bin")
+endif()
+
# CMake omits default compiler include paths, but in runtimes build, we use
# -nostdinc and -nostdinc++ and control include paths manually so this behavior
# is undesirable. Filtering CMAKE_{LANG}_IMPLICIT_INCLUDE_DIRECTORIES to remove
>From c8e73cae146ba31b77ab4ab79645b6be0993be4a Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Sun, 16 Nov 2025 13:39:14 +0100
Subject: [PATCH 2/2] Fix wrong uses of LLVM_RUNTIME_OUTPUT_INTDIR in
compiler-rt
---
compiler-rt/cmake/base-config-ix.cmake | 4 ++--
compiler-rt/lib/sanitizer_common/symbolizer/CMakeLists.txt | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index d92bc0e71fa1a..37dfa5534dfef 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -59,9 +59,9 @@ if (LLVM_TREE_AVAILABLE)
set(_host_executable_suffix ${CMAKE_EXECUTABLE_SUFFIX})
endif()
set(COMPILER_RT_TEST_COMPILER
- ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang${_host_executable_suffix})
+ ${LLVM_TOOLS_BINARY_DIR}/clang${_host_executable_suffix})
set(COMPILER_RT_TEST_CXX_COMPILER
- ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++${_host_executable_suffix})
+ ${LLVM_TOOLS_BINARY_DIR}/clang++${_host_executable_suffix})
else()
# Take output dir and install path from the user.
set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
diff --git a/compiler-rt/lib/sanitizer_common/symbolizer/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/symbolizer/CMakeLists.txt
index ab37454acbe19..bb8298931c390 100644
--- a/compiler-rt/lib/sanitizer_common/symbolizer/CMakeLists.txt
+++ b/compiler-rt/lib/sanitizer_common/symbolizer/CMakeLists.txt
@@ -13,7 +13,7 @@ foreach(arch ${SANITIZER_COMMON_SUPPORTED_ARCH})
scripts/build_symbolizer.sh
WORKING_DIRECTORY ${RTSanitizerCommonSymbolizerInternalDir}
COMMAND FLAGS=${TARGET_CFLAGS}
- CLANG=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+ CLANG=${LLVM_TOOLS_BINARY_DIR}/clang
${CMAKE_CURRENT_SOURCE_DIR}/scripts/build_symbolizer.sh
${CMAKE_CURRENT_BINARY_DIR}/RTSanitizerCommonSymbolizerInternal.${arch}.o
USES_TERMINAL)
More information about the llvm-commits
mailing list