From e5639e9dd9d5904b4f12f74d98653ea6c0ec1982 Mon Sep 17 00:00:00 2001 From: Martell Malone Date: Sun, 15 Oct 2017 17:53:45 +0000 Subject: [PATCH] Driver: use ld64.lld when -fuse-ld=lld for darwin When using lld on macOS the current level of detection between ld and ld64 forces us to rename lld to ld. For ELF targets we have the ld.lld alias so for MACHO we should have ld64.lld so we can use lld without replacing the system compiler. This also solves the additional issue of cross compiling for MACHO where renaming lld to ld with only target ELF. This is the clang driver component change to use this new alias. Reviewers: ruiu, rnk Differential Revision: https://reviews.llvm.org/D38290 llvm-svn: 315867 --- clang/lib/Driver/ToolChain.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index de23bf6f3ebb..593cd82038f2 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -390,7 +390,11 @@ std::string ToolChain::GetLinkerPath() const { // then use whatever the default system linker is. return GetProgramPath(getDefaultLinker()); } else { - llvm::SmallString<8> LinkerName("ld."); + llvm::SmallString<8> LinkerName; + if (Triple.isOSDarwin()) + LinkerName.append("ld64."); + else + LinkerName.append("ld."); LinkerName.append(UseLinker); std::string LinkerPath(GetProgramPath(LinkerName.c_str()));