1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[CMAKE] Find ld64 using xcrun

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

llvm-svn: 276781
This commit is contained in:
Bruno Cardoso Lopes 2016-07-26 18:09:23 +00:00
parent ddccb3944c
commit e4279b249c

View File

@ -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)