Skip to content

Commit d7b4deb

Browse files
authored
[cmake,Apple] Check ld-classic when looking for ld64. (llvm#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.
1 parent f1d75d0 commit d7b4deb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

llvm/cmake/config-ix.cmake

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,12 +639,25 @@ if(CMAKE_HOST_APPLE AND APPLE)
639639
if(NOT CMAKE_XCRUN)
640640
find_program(CMAKE_XCRUN NAMES xcrun)
641641
endif()
642+
643+
# First, check if there's ld-classic, which is ld64 in newer SDKs.
642644
if(CMAKE_XCRUN)
643-
execute_process(COMMAND ${CMAKE_XCRUN} -find ld
645+
execute_process(COMMAND ${CMAKE_XCRUN} -find ld-classic
644646
OUTPUT_VARIABLE LD64_EXECUTABLE
645647
OUTPUT_STRIP_TRAILING_WHITESPACE)
646648
else()
647-
find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
649+
find_program(LD64_EXECUTABLE NAMES ld-classic DOC "The ld64 linker")
650+
endif()
651+
652+
# Otherwise look for ld directly.
653+
if(NOT LD64_EXECUTABLE)
654+
if(CMAKE_XCRUN)
655+
execute_process(COMMAND ${CMAKE_XCRUN} -find ld
656+
OUTPUT_VARIABLE LD64_EXECUTABLE
657+
OUTPUT_STRIP_TRAILING_WHITESPACE)
658+
else()
659+
find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
660+
endif()
648661
endif()
649662
endif()
650663

0 commit comments

Comments
 (0)