[clang][cmake] Use llvm-libtool-darwin in clang multi-stage build (#177277)

We are seeing the build system uses the XCode's libtool when building
the 2nd stage of the clang on mac. We should use the llvm-libtool-darwin
from the previous stage clang build instead. This patch makes multi-stage
clang build to use llvm-libtool-darwin from the previous stage when targeting
mac.
This commit is contained in:
Haowei 2026-01-21 22:50:09 -08:00 committed by GitHub
parent 1b37911f1a
commit a581ceb3e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -645,6 +645,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
# variable, and have LLVM's CMake append the envar to the archiver calls.
set(LTO_LIBRARY -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib
-DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR})
set(${CLANG_STAGE}_LIBTOOL -DCMAKE_LIBTOOL=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-libtool-darwin)
elseif(MSVC)
add_dependencies(clang-bootstrap-deps llvm-lib)
set(${CLANG_STAGE}_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-lib)
@ -845,6 +846,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
${${CLANG_STAGE}_RANLIB}
${${CLANG_STAGE}_OBJCOPY}
${${CLANG_STAGE}_STRIP}
${${CLANG_STAGE}_LIBTOOL}
BUILD_COMMAND ${CMAKE_COMMAND} --build ${BINARY_DIR}
--config ${build_configuration}
${build_tool_args}