[PATCH] D22791: [CMAKE] Find ld64 using xcrun

Bruno Cardoso Lopes via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 17:30:07 PDT 2016


bruno created this revision.
bruno added a reviewer: beanz.
bruno added a subscriber: llvm-commits.

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.

To get http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check green, we need to pass DYLD_INSERT_LIBRARIES=<PATH_TO>/libclang_rt.asan_osx_dynamic.dylib to ld64, which currently won't work because we're invoking /usr/bin/ld.

https://reviews.llvm.org/D22791

Files:
  cmake/config-ix.cmake

Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -548,8 +548,19 @@
 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22791.65453.patch
Type: text/x-patch
Size: 825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160726/ae411edb/attachment.bin>


More information about the llvm-commits mailing list