Skip to content

Commit f9db0d2

Browse files
authored
[cmake][runtimes] Add missing dependency on LLVMgold.so (#94199)
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.)
1 parent 794457f commit f9db0d2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/cmake/modules/LLVMExternalProjectUtils.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ function(llvm_ExternalProject_Add name source_dir)
240240
list(APPEND compiler_args -DCMAKE_RC_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-rc${CMAKE_EXECUTABLE_SUFFIX})
241241
endif()
242242
list(APPEND ARG_DEPENDS ${TOOLCHAIN_TOOLS})
243+
# Add LLVMgold.so dependency if it is available, as clang may need it for
244+
# LTO.
245+
if(CLANG_IN_TOOLCHAIN AND TARGET LLVMgold)
246+
list(APPEND ARG_DEPENDS LLVMgold)
247+
endif()
243248
endif()
244249

245250
if(ARG_STRIP_TOOL)

0 commit comments

Comments
 (0)