[PATCH] D82777: Clang Driver: Use Apple ld64's new @response-file support.
James Y Knight via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 29 15:33:16 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG381df1653c92: Clang Driver: Use Apple ld64's new @response-file support. (authored by jyknight).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82777/new/
https://reviews.llvm.org/D82777
Files:
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Driver/ToolChains/Darwin.h
Index: clang/lib/Driver/ToolChains/Darwin.h
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.h
+++ clang/lib/Driver/ToolChains/Darwin.h
@@ -69,9 +69,10 @@
const InputInfoList &Inputs) const;
public:
- Linker(const ToolChain &TC)
- : MachOTool("darwin::Linker", "linker", TC, RF_FileList,
- llvm::sys::WEM_UTF8, "-filelist") {}
+ Linker(const ToolChain &TC, bool UseAtFile)
+ : MachOTool("darwin::Linker", "linker", TC,
+ UseAtFile ? RF_Full : RF_FileList, llvm::sys::WEM_UTF8,
+ UseAtFile ? "@" : "-filelist") {}
bool hasIntegratedCPP() const override { return false; }
bool isLinkJob() const override { return true; }
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -929,7 +929,22 @@
}
}
-Tool *MachO::buildLinker() const { return new tools::darwin::Linker(*this); }
+Tool *MachO::buildLinker() const {
+ // Determine whether to use an @responsefile or the old -filelist mechanism.
+ bool UseAtFile = false;
+ unsigned Version[5] = {0, 0, 0, 0, 0};
+ if (Arg *A =
+ getArgs_DO_NOT_USE().getLastArg(options::OPT_mlinker_version_EQ)) {
+ // We don't need to diagnose a parse error here, it'll be caught in
+ // ConstructJob.
+ if (Driver::GetReleaseVersion(A->getValue(), Version)) {
+ if (Version[0] >= 607)
+ UseAtFile = true;
+ }
+ }
+
+ return new tools::darwin::Linker(*this, UseAtFile);
+}
Tool *MachO::buildAssembler() const {
return new tools::darwin::Assembler(*this);
Index: clang/include/clang/Driver/ToolChain.h
===================================================================
--- clang/include/clang/Driver/ToolChain.h
+++ clang/include/clang/Driver/ToolChain.h
@@ -201,6 +201,9 @@
// Accessors
+ /// Temporary for Darwin::Linker
+ const llvm::opt::ArgList &getArgs_DO_NOT_USE() const { return Args; }
+
const Driver &getDriver() const { return D; }
llvm::vfs::FileSystem &getVFS() const;
const llvm::Triple &getTriple() const { return Triple; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82777.274267.patch
Type: text/x-patch
Size: 2237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200629/9086d314/attachment-0001.bin>
More information about the cfe-commits
mailing list