Skip to content

[cmake,Apple] Check ld-classic when looking for ld64. #77136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions llvm/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down