Skip to content

Commit 85d27d1

Browse files
authored
Merge pull request #3636 from compnerd/lld-less
cherry-pick upstream changes to remove "old" Darwin lld support
2 parents 7f0448c + 205a50d commit 85d27d1

File tree

253 files changed

+18
-36491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+18
-36491
lines changed

clang/include/clang/Driver/ToolChain.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,7 @@ class ToolChain {
341341
/// is LLD. If it's set, it can be assumed that the linker is LLD built
342342
/// at the same revision as clang, and clang can make assumptions about
343343
/// LLD's supported flags, error output, etc.
344-
/// If LinkerIsLLDDarwinNew is non-nullptr, it's set if the linker is
345-
/// the new version in lld/MachO.
346-
std::string GetLinkerPath(bool *LinkerIsLLD = nullptr,
347-
bool *LinkerIsLLDDarwinNew = nullptr) const;
344+
std::string GetLinkerPath(bool *LinkerIsLLD = nullptr) const;
348345

349346
/// Returns the linker path for emitting a static library.
350347
std::string GetStaticLibToolPath() const;

clang/lib/Driver/ToolChain.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -543,12 +543,9 @@ std::string ToolChain::GetProgramPath(const char *Name) const {
543543
return D.GetProgramPath(Name, *this);
544544
}
545545

546-
std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD,
547-
bool *LinkerIsLLDDarwinNew) const {
546+
std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD) const {
548547
if (LinkerIsLLD)
549548
*LinkerIsLLD = false;
550-
if (LinkerIsLLDDarwinNew)
551-
*LinkerIsLLDDarwinNew = false;
552549

553550
// Get -fuse-ld= first to prevent -Wunused-command-line-argument. -fuse-ld= is
554551
// considered as the linker flavor, e.g. "bfd", "gold", or "lld".
@@ -601,11 +598,8 @@ std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD,
601598

602599
std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
603600
if (llvm::sys::fs::can_execute(LinkerPath)) {
604-
// FIXME: Remove LinkerIsLLDDarwinNew once there's only one MachO lld.
605601
if (LinkerIsLLD)
606-
*LinkerIsLLD = UseLinker == "lld" || UseLinker == "lld.darwinold";
607-
if (LinkerIsLLDDarwinNew)
608-
*LinkerIsLLDDarwinNew = UseLinker == "lld";
602+
*LinkerIsLLD = UseLinker == "lld";
609603
return LinkerPath;
610604
}
611605
}

clang/lib/Driver/ToolChains/Darwin.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ static bool shouldLinkerNotDedup(bool IsLinkerOnlyAction, const ArgList &Args) {
209209
void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Args,
210210
ArgStringList &CmdArgs,
211211
const InputInfoList &Inputs,
212-
unsigned Version[5], bool LinkerIsLLD,
213-
bool LinkerIsLLDDarwinNew) const {
212+
unsigned Version[5], bool LinkerIsLLD) const {
214213
const Driver &D = getToolChain().getDriver();
215214
const toolchains::MachO &MachOTC = getMachOToolChain();
216215

@@ -343,7 +342,7 @@ void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Args,
343342
Args.AddAllArgs(CmdArgs, options::OPT_init);
344343

345344
// Add the deployment target.
346-
if (Version[0] >= 520 || LinkerIsLLDDarwinNew)
345+
if (Version[0] >= 520 || LinkerIsLLD)
347346
MachOTC.addPlatformVersionArgs(Args, CmdArgs);
348347
else
349348
MachOTC.addMinVersionArgs(Args, CmdArgs);
@@ -561,14 +560,13 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
561560
<< A->getAsString(Args);
562561
}
563562

564-
bool LinkerIsLLD, LinkerIsLLDDarwinNew;
565-
const char *Exec = Args.MakeArgString(
566-
getToolChain().GetLinkerPath(&LinkerIsLLD, &LinkerIsLLDDarwinNew));
563+
bool LinkerIsLLD;
564+
const char *Exec =
565+
Args.MakeArgString(getToolChain().GetLinkerPath(&LinkerIsLLD));
567566

568567
// I'm not sure why this particular decomposition exists in gcc, but
569568
// we follow suite for ease of comparison.
570-
AddLinkArgs(C, Args, CmdArgs, Inputs, Version, LinkerIsLLD,
571-
LinkerIsLLDDarwinNew);
569+
AddLinkArgs(C, Args, CmdArgs, Inputs, Version, LinkerIsLLD);
572570

573571
if (willEmitRemarks(Args) &&
574572
checkRemarksOptions(getToolChain().getDriver(), Args,
@@ -720,7 +718,7 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
720718
}
721719

722720
ResponseFileSupport ResponseSupport;
723-
if (Version[0] >= 705 || LinkerIsLLDDarwinNew) {
721+
if (Version[0] >= 705 || LinkerIsLLD) {
724722
ResponseSupport = ResponseFileSupport::AtFileUTF8();
725723
} else {
726724
// For older versions of the linker, use the legacy filelist method instead.

clang/lib/Driver/ToolChains/Darwin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class LLVM_LIBRARY_VISIBILITY Linker : public MachOTool {
6464
void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
6565
llvm::opt::ArgStringList &CmdArgs,
6666
const InputInfoList &Inputs, unsigned Version[5],
67-
bool LinkerIsLLD, bool LinkerIsLLDDarwinNew) const;
67+
bool LinkerIsLLD) const;
6868

6969
public:
7070
Linker(const ToolChain &TC) : MachOTool("darwin::Linker", "linker", TC) {}

clang/test/Driver/darwin-ld-demangle-lld.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// With -fuse-ld=lld, -demangle is always passed to the linker on Darwin.
22
// REQUIRES: shell
33

4-
// FIXME: Remove this test case when we remove the lld.darwinold backend.
5-
// RUN: %clang --target=x86_64-apple-darwin -### \
6-
// RUN: -fuse-ld=lld.darwinold -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
7-
// RUN: | FileCheck %s
8-
94
// RUN: %clang --target=x86_64-apple-darwin -### \
105
// RUN: -fuse-ld=lld -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
116
// RUN: | FileCheck %s

clang/test/Driver/darwin-ld-platform-version-ios.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// RUN: touch %t.o
22

3-
// RUN: %clang -target arm64-apple-ios12.3 -fuse-ld=lld.darwinold \
4-
// RUN: -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
5-
// RUN: -### %t.o 2>&1 \
6-
// RUN: | FileCheck --check-prefix=LINKER-OLD %s
73
// RUN: %clang -target arm64-apple-ios12.3 -fuse-ld= \
84
// RUN: -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
95
// RUN: -### %t.o 2>&1 \

clang/test/Driver/darwin-ld-platform-version-macos.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// RUN: touch %t.o
22

3-
// RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld.darwinold \
4-
// RUN: -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
5-
// RUN: -### %t.o 2>&1 \
6-
// RUN: | FileCheck --check-prefix=LINKER-OLD %s
73
// RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld \
84
// RUN: -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
95
// RUN: -### %t.o -B%S/Inputs/lld 2>&1 \

clang/test/Driver/darwin-ld-platform-version-tvos.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// RUN: touch %t.o
22

3-
// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld=lld.darwinold \
4-
// RUN: -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
5-
// RUN: -### %t.o 2>&1 \
6-
// RUN: | FileCheck --check-prefix=LINKER-OLD %s
73
// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld= \
84
// RUN: -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
95
// RUN: -### %t.o 2>&1 \

clang/test/Driver/darwin-ld-platform-version-watchos.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// RUN: touch %t.o
22

3-
// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinold \
4-
// RUN: -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
5-
// RUN: -### %t.o 2>&1 \
6-
// RUN: | FileCheck --check-prefix=LINKER-OLD %s
73
// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld= \
84
// RUN: -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=400 \
95
// RUN: -### %t.o 2>&1 \

lld/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,10 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
195195
endif()
196196

197197
add_subdirectory(Common)
198-
add_subdirectory(lib)
199198
add_subdirectory(tools/lld)
200199

201200
if (LLVM_INCLUDE_TESTS)
202201
add_subdirectory(test)
203-
add_subdirectory(unittests)
204202
endif()
205203

206204
add_subdirectory(docs)

lld/include/lld/Common/Driver.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ bool link(llvm::ArrayRef<const char *> args, bool canExitEarly,
4242
llvm::raw_ostream &stdoutOS, llvm::raw_ostream &stderrOS);
4343
}
4444

45-
namespace mach_o {
46-
bool link(llvm::ArrayRef<const char *> args, bool canExitEarly,
47-
llvm::raw_ostream &stdoutOS, llvm::raw_ostream &stderrOS);
48-
}
49-
5045
namespace macho {
5146
bool link(llvm::ArrayRef<const char *> args, bool canExitEarly,
5247
llvm::raw_ostream &stdoutOS, llvm::raw_ostream &stderrOS);

lld/include/lld/Core/Reference.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ class Reference {
4242
public:
4343
/// Which universe defines the kindValue().
4444
enum class KindNamespace {
45-
all = 0,
45+
all = 0,
4646
testing = 1,
47-
mach_o = 2,
4847
};
4948

5049
KindNamespace kindNamespace() const { return (KindNamespace)_kindNamespace; }

0 commit comments

Comments
 (0)