[llvm] d7b4deb - [cmake,Apple] Check ld-classic when looking for ld64. (#77136)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 5 14:13:29 PST 2024
Author: Florian Hahn
Date: 2024-01-05T22:13:25Z
New Revision: d7b4debf98fd740f821bda717de7b807e26ae95a
URL: https://github.com/llvm/llvm-project/commit/d7b4debf98fd740f821bda717de7b807e26ae95a
DIFF: https://github.com/llvm/llvm-project/commit/d7b4debf98fd740f821bda717de7b807e26ae95a.diff
LOG: [cmake,Apple] Check ld-classic when looking for ld64. (#77136)
In newer SDKs, ld64 is called ld-classic. Look for it first, as ld in
those SDKs is still missing some functionality some tests depend on.
This enables running the tests from check-llvm-tools-lto with newer SDKs
on ARM64 macOS.
Added:
Modified:
llvm/cmake/config-ix.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 3e12213f6e6b5d..bf1b110245bb2f 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -639,12 +639,25 @@ if(CMAKE_HOST_APPLE AND APPLE)
if(NOT CMAKE_XCRUN)
find_program(CMAKE_XCRUN NAMES xcrun)
endif()
+
+ # First, check if there's ld-classic, which is ld64 in newer SDKs.
if(CMAKE_XCRUN)
- execute_process(COMMAND ${CMAKE_XCRUN} -find ld
+ execute_process(COMMAND ${CMAKE_XCRUN} -find ld-classic
OUTPUT_VARIABLE LD64_EXECUTABLE
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
- find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
+ find_program(LD64_EXECUTABLE NAMES ld-classic DOC "The ld64 linker")
+ endif()
+
+ # Otherwise look for ld directly.
+ if(NOT LD64_EXECUTABLE)
+ if(CMAKE_XCRUN)
+ execute_process(COMMAND ${CMAKE_XCRUN} -find ld
+ OUTPUT_VARIABLE LD64_EXECUTABLE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else()
+ find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
+ endif()
endif()
endif()
More information about the llvm-commits
mailing list