summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2024-01-05 22:13:25 +0000
committerGitHub <noreply@github.com>2024-01-05 22:13:25 +0000
commitd7b4debf98fd740f821bda717de7b807e26ae95a (patch)
tree8248db89fe46be5d6c9af6b400dafbece19f92d5
parentf1d75d08adb9841dd9cebad63b76d4823ec2bdac (diff)
[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.
-rw-r--r--llvm/cmake/config-ix.cmake17
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 3e12213f6e6b..bf1b110245bb 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()