[llvm] [cmake][runtimes] Add missing dependency on LLVMgold.so (PR #94199)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 02:32:38 PDT 2024
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/94199
When doing a runtimes build with LTO using ld.bfd (or ld.gold), the build starts failing with [ninja 1.12](https://github.com/ninja-build/ninja/releases/tag/v1.12.0), which added a new critical path scheduler. The reason is that LLVMgold.so is not available yet at the point where runtimes start being build, leading to configuration failures in the nested cmake invocation.
Fix this by adding an explicit dependency on LLVMgold.so if it is available. (It may not always be necessary, e.g. if the used linker is lld, but it would be hard to detect when exactly it may or may not be needed, so always adding the dependency is safer.)
>From a0fe4e697e38e9aca89895c9fadbce204958f236 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Mon, 3 Jun 2024 10:55:04 +0200
Subject: [PATCH] [cmake][runtimes] Add missing dependency on LLVMgold.so
When doing a runtimes build with LTO using ld.bfd (or ld.gold),
the build starts failing with ninja 1.12, which added a new
critical path scheduler. The reason is that LLVMgold.so is not
available yet at the point where runtimes start being build,
leading to configuration failures in the nested cmake invocation.
Fix this by adding an explicit dependency on LLVMgold.so if it
is available. (It may not always be necessary, e.g. if the used
linker is lld, but it would be hard to detect when exactly it may
or may not be needed, so always adding the dependency is safer.)
---
llvm/cmake/modules/LLVMExternalProjectUtils.cmake | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
index 60aed21143fd3..87a335bafdc9a 100644
--- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -240,6 +240,11 @@ function(llvm_ExternalProject_Add name source_dir)
list(APPEND compiler_args -DCMAKE_RC_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-rc${CMAKE_EXECUTABLE_SUFFIX})
endif()
list(APPEND ARG_DEPENDS ${TOOLCHAIN_TOOLS})
+ # Add LLVMgold.so dependency if it is available, as clang may need it for
+ # LTO.
+ if(CLANG_IN_TOOLCHAIN AND TARGET LLVMgold)
+ list(APPEND ARG_DEPENDS LLVMgold)
+ endif()
endif()
if(ARG_STRIP_TOOL)
More information about the llvm-commits
mailing list