Skip to content

Commit

Permalink
[CMAKE] Find ld64 using xcrun
Browse files Browse the repository at this point in the history
Given similar reasons from r276710, ld64 scrubs DYLD_* environment if
called from the shim executable /usr/bin/ld.

Add support for finding ld64 via xcrun.

This is needed in order to get LIT to have the full path to the ld4
executable.

Differential Revision: https://reviews.llvm.org/D22791

rdar://problem/24300926

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276781 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
bcardosolopes committed Jul 26, 2016
1 parent 5d321c1 commit 98a069f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,19 @@ find_program(GOLD_EXECUTABLE NAMES ${LLVM_DEFAULT_TARGET_TRIPLE}-ld.gold ld.gold
set(LLVM_BINUTILS_INCDIR "" CACHE PATH
"PATH to binutils/include containing plugin-api.h for gold plugin.")

if(APPLE)
find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
if(CMAKE_HOST_APPLE AND APPLE)
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()

if(LD64_EXECUTABLE)
set(LD64_EXECUTABLE ${LD64_EXECUTABLE} CACHE PATH "ld64 executable")
message(STATUS "Found ld64 - ${LD64_EXECUTABLE}")
endif()
endif()

include(FindOCaml)
Expand Down

0 comments on commit 98a069f

Please sign in to comment.