This is an archive of the discontinued LLVM Phabricator instance.

[CMAKE] Find ld64 using xcrun
ClosedPublic

Authored by bruno on Jul 25 2016, 5:30 PM.

Details

Summary

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.

Diff Detail

Event Timeline

bruno updated this revision to Diff 65453.Jul 25 2016, 5:30 PM
bruno retitled this revision from to [CMAKE] Find ld64 using xcrun.
bruno updated this object.
bruno added a reviewer: beanz.
bruno added a subscriber: llvm-commits.
beanz edited edge metadata.Jul 25 2016, 5:32 PM

@bruno, we shouldn't need to do this for LD64 because the DARWIN_LTO_LIBRARY option passes the LTO library into ld64 via the linker flags.

bruno added a comment.Jul 25 2016, 5:38 PM

Makes sense for the libLTO case, however, we need lit to be able to pass down DYLD_INSERT_LIBRARIES=<PATH_TO>/libclang_rt.asan_osx_dynamic.dylib to ld64, which won't work for /usr/bin/ld. LIT obtain the ld64 executable through CMAKE:

test/lit.site.cfg.in:config.ld64_executable = "@LD64_EXECUTABLE@"

I'm avoiding to gather ld64 path once again in LIT because it seems clean to use the same LD64, suggestions?

beanz accepted this revision.Jul 25 2016, 5:58 PM
beanz edited edge metadata.

Ah! I understand what you're doing. This LGTM.

This revision is now accepted and ready to land.Jul 25 2016, 5:58 PM
bruno closed this revision.Jul 26 2016, 11:17 AM

Thanks Chris,

Committed r276781