[clang] ace03d0 - [clang][Darwin] Remove old lld implementation handling

Keith Smiley via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 2 16:29:42 PST 2021


Author: Keith Smiley
Date: 2021-12-02T16:29:26-08:00
New Revision: ace03d0df4fa861981c79a38892584bcbc4e3c15

URL: https://github.com/llvm/llvm-project/commit/ace03d0df4fa861981c79a38892584bcbc4e3c15
DIFF: https://github.com/llvm/llvm-project/commit/ace03d0df4fa861981c79a38892584bcbc4e3c15.diff

LOG: [clang][Darwin] Remove old lld implementation handling

This now assumes that for the darwin driver any lld is the "new" macho
lld implementation.

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

Added: 
    

Modified: 
    clang/include/clang/Driver/ToolChain.h
    clang/lib/Driver/ToolChain.cpp
    clang/lib/Driver/ToolChains/Darwin.cpp
    clang/lib/Driver/ToolChains/Darwin.h
    clang/test/Driver/darwin-ld-demangle-lld.c
    clang/test/Driver/darwin-ld-platform-version-ios.c
    clang/test/Driver/darwin-ld-platform-version-macos.c
    clang/test/Driver/darwin-ld-platform-version-tvos.c
    clang/test/Driver/darwin-ld-platform-version-watchos.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index dad861d586cb5..e7b13eec3fc14 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -348,10 +348,7 @@ class ToolChain {
   /// is LLD. If it's set, it can be assumed that the linker is LLD built
   /// at the same revision as clang, and clang can make assumptions about
   /// LLD's supported flags, error output, etc.
-  /// If LinkerIsLLDDarwinNew is non-nullptr, it's set if the linker is
-  /// the new version in lld/MachO.
-  std::string GetLinkerPath(bool *LinkerIsLLD = nullptr,
-                            bool *LinkerIsLLDDarwinNew = nullptr) const;
+  std::string GetLinkerPath(bool *LinkerIsLLD = nullptr) const;
 
   /// Returns the linker path for emitting a static library.
   std::string GetStaticLibToolPath() const;

diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 6588cdf9fecd1..ac033dd427c2d 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -541,12 +541,9 @@ std::string ToolChain::GetProgramPath(const char *Name) const {
   return D.GetProgramPath(Name, *this);
 }
 
-std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD,
-                                     bool *LinkerIsLLDDarwinNew) const {
+std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD) const {
   if (LinkerIsLLD)
     *LinkerIsLLD = false;
-  if (LinkerIsLLDDarwinNew)
-    *LinkerIsLLDDarwinNew = false;
 
   // Get -fuse-ld= first to prevent -Wunused-command-line-argument. -fuse-ld= is
   // considered as the linker flavor, e.g. "bfd", "gold", or "lld".
@@ -599,11 +596,8 @@ std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD,
 
     std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
     if (llvm::sys::fs::can_execute(LinkerPath)) {
-      // FIXME: Remove LinkerIsLLDDarwinNew once there's only one MachO lld.
       if (LinkerIsLLD)
-        *LinkerIsLLD = UseLinker == "lld" || UseLinker == "lld.darwinold";
-      if (LinkerIsLLDDarwinNew)
-        *LinkerIsLLDDarwinNew = UseLinker == "lld";
+        *LinkerIsLLD = UseLinker == "lld";
       return LinkerPath;
     }
   }

diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 06d3edc70e45f..89d8fbe795e6e 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -209,8 +209,7 @@ static bool shouldLinkerNotDedup(bool IsLinkerOnlyAction, const ArgList &Args) {
 void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Args,
                                  ArgStringList &CmdArgs,
                                  const InputInfoList &Inputs,
-                                 unsigned Version[5], bool LinkerIsLLD,
-                                 bool LinkerIsLLDDarwinNew) const {
+                                 unsigned Version[5], bool LinkerIsLLD) const {
   const Driver &D = getToolChain().getDriver();
   const toolchains::MachO &MachOTC = getMachOToolChain();
 
@@ -343,7 +342,7 @@ void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Args,
   Args.AddAllArgs(CmdArgs, options::OPT_init);
 
   // Add the deployment target.
-  if (Version[0] >= 520 || LinkerIsLLDDarwinNew)
+  if (Version[0] >= 520 || LinkerIsLLD)
     MachOTC.addPlatformVersionArgs(Args, CmdArgs);
   else
     MachOTC.addMinVersionArgs(Args, CmdArgs);
@@ -556,14 +555,13 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
           << A->getAsString(Args);
   }
 
-  bool LinkerIsLLD, LinkerIsLLDDarwinNew;
-  const char *Exec = Args.MakeArgString(
-      getToolChain().GetLinkerPath(&LinkerIsLLD, &LinkerIsLLDDarwinNew));
+  bool LinkerIsLLD;
+  const char *Exec =
+      Args.MakeArgString(getToolChain().GetLinkerPath(&LinkerIsLLD));
 
   // I'm not sure why this particular decomposition exists in gcc, but
   // we follow suite for ease of comparison.
-  AddLinkArgs(C, Args, CmdArgs, Inputs, Version, LinkerIsLLD,
-              LinkerIsLLDDarwinNew);
+  AddLinkArgs(C, Args, CmdArgs, Inputs, Version, LinkerIsLLD);
 
   if (willEmitRemarks(Args) &&
       checkRemarksOptions(getToolChain().getDriver(), Args,
@@ -715,7 +713,7 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
   }
 
   ResponseFileSupport ResponseSupport;
-  if (Version[0] >= 705 || LinkerIsLLDDarwinNew) {
+  if (Version[0] >= 705 || LinkerIsLLD) {
     ResponseSupport = ResponseFileSupport::AtFileUTF8();
   } else {
     // For older versions of the linker, use the legacy filelist method instead.

diff  --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h
index a307cd317ac39..5e23047a5512e 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -64,7 +64,7 @@ class LLVM_LIBRARY_VISIBILITY Linker : public MachOTool {
   void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
                    llvm::opt::ArgStringList &CmdArgs,
                    const InputInfoList &Inputs, unsigned Version[5],
-                   bool LinkerIsLLD, bool LinkerIsLLDDarwinNew) const;
+                   bool LinkerIsLLD) const;
 
 public:
   Linker(const ToolChain &TC) : MachOTool("darwin::Linker", "linker", TC) {}

diff  --git a/clang/test/Driver/darwin-ld-demangle-lld.c b/clang/test/Driver/darwin-ld-demangle-lld.c
index 9610f6bc10164..3d44c3d432f24 100644
--- a/clang/test/Driver/darwin-ld-demangle-lld.c
+++ b/clang/test/Driver/darwin-ld-demangle-lld.c
@@ -1,11 +1,6 @@
 // With -fuse-ld=lld, -demangle is always passed to the linker on Darwin.
 // REQUIRES: shell
 
-// FIXME: Remove this test case when we remove the lld.darwinold backend.
-// RUN: %clang --target=x86_64-apple-darwin -### \
-// RUN:   -fuse-ld=lld.darwinold -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
-// RUN:   | FileCheck %s
-
 // RUN: %clang --target=x86_64-apple-darwin -### \
 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
 // RUN:   | FileCheck %s

diff  --git a/clang/test/Driver/darwin-ld-platform-version-ios.c b/clang/test/Driver/darwin-ld-platform-version-ios.c
index bd518c315149f..685caa7aefe31 100644
--- a/clang/test/Driver/darwin-ld-platform-version-ios.c
+++ b/clang/test/Driver/darwin-ld-platform-version-ios.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-ios12.3 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target arm64-apple-ios12.3 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \

diff  --git a/clang/test/Driver/darwin-ld-platform-version-macos.c b/clang/test/Driver/darwin-ld-platform-version-macos.c
index 8778281925d6b..355df8dfc1bc2 100644
--- a/clang/test/Driver/darwin-ld-platform-version-macos.c
+++ b/clang/test/Driver/darwin-ld-platform-version-macos.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld \
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \

diff  --git a/clang/test/Driver/darwin-ld-platform-version-tvos.c b/clang/test/Driver/darwin-ld-platform-version-tvos.c
index bf57c26bf25c4..28890cffd17a0 100644
--- a/clang/test/Driver/darwin-ld-platform-version-tvos.c
+++ b/clang/test/Driver/darwin-ld-platform-version-tvos.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \

diff  --git a/clang/test/Driver/darwin-ld-platform-version-watchos.c b/clang/test/Driver/darwin-ld-platform-version-watchos.c
index 639c937d6be5c..3d405a7c09f62 100644
--- a/clang/test/Driver/darwin-ld-platform-version-watchos.c
+++ b/clang/test/Driver/darwin-ld-platform-version-watchos.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \


        


More information about the cfe-commits mailing list