Skip to content

Commit 507d12f

Browse files
authored
Merge pull request #635 from swiftwasm/swift/release/5.3
[pull] swiftwasm-release/5.3 from swift/release/5.3
2 parents b06e8dd + 57d79ca commit 507d12f

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

clang/include/clang/Driver/ToolChain.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ class ToolChain {
196196

197197
// Accessors
198198

199+
/// Temporary for Darwin::Linker
200+
const llvm::opt::ArgList &getArgs_DO_NOT_USE() const { return Args; }
201+
199202
const Driver &getDriver() const { return D; }
200203
llvm::vfs::FileSystem &getVFS() const;
201204
const llvm::Triple &getTriple() const { return Triple; }

clang/lib/Driver/ToolChains/Darwin.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,22 @@ Tool *MachO::getTool(Action::ActionClass AC) const {
937937
}
938938
}
939939

940-
Tool *MachO::buildLinker() const { return new tools::darwin::Linker(*this); }
940+
Tool *MachO::buildLinker() const {
941+
// Determine whether to use an @responsefile or the old -filelist mechanism.
942+
bool UseAtFile = false;
943+
unsigned Version[5] = {0, 0, 0, 0, 0};
944+
if (Arg *A =
945+
getArgs_DO_NOT_USE().getLastArg(options::OPT_mlinker_version_EQ)) {
946+
// We don't need to diagnose a parse error here, it'll be caught in
947+
// ConstructJob.
948+
if (Driver::GetReleaseVersion(A->getValue(), Version)) {
949+
if (Version[0] >= 607)
950+
UseAtFile = true;
951+
}
952+
}
953+
954+
return new tools::darwin::Linker(*this, UseAtFile);
955+
}
941956

942957
Tool *MachO::buildAssembler() const {
943958
return new tools::darwin::Assembler(*this);

clang/lib/Driver/ToolChains/Darwin.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ class LLVM_LIBRARY_VISIBILITY Linker : public MachOTool {
6969
const InputInfoList &Inputs) const;
7070

7171
public:
72-
Linker(const ToolChain &TC)
73-
: MachOTool("darwin::Linker", "linker", TC, RF_FileList,
74-
llvm::sys::WEM_UTF8, "-filelist") {}
72+
Linker(const ToolChain &TC, bool UseAtFile)
73+
: MachOTool("darwin::Linker", "linker", TC,
74+
UseAtFile ? RF_Full : RF_FileList, llvm::sys::WEM_UTF8,
75+
UseAtFile ? "@" : "-filelist") {}
7576

7677
bool hasIntegratedCPP() const override { return false; }
7778
bool isLinkJob() const override { return true; }

0 commit comments

Comments
 (0)