[PATCH] D148383: [driver] Enable response file when using lld on baremetal targets

Haowei Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 14 14:49:51 PDT 2023


haowei created this revision.
haowei added reviewers: mcgrathr, phosek.
Herald added a subscriber: abidh.
Herald added a project: All.
haowei requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

This patch enables response file support when using lld on baremetal targets


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148383

Files:
  clang/lib/Driver/ToolChains/BareMetal.cpp


Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===================================================================
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -345,7 +345,14 @@
   CmdArgs.push_back("-o");
   CmdArgs.push_back(Output.getFilename());
 
-  C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
+  const char *Linker = Args.MakeArgString(TC.GetLinkerPath());
+  ResponseFileSupport LinkerResponseFileSupport = ResponseFileSupport::AtFileCurCP();
+  if (llvm::sys::path::filename(Linker) != "ld.lld" &&
+      llvm::sys::path::stem(Linker) != "ld.lld") {
+        LinkerResponseFileSupport = ResponseFileSupport::None();
+  }
+
+  C.addCommand(std::make_unique<Command>(JA, *this, LinkerResponseFileSupport,
                                          Args.MakeArgString(TC.GetLinkerPath()),
                                          CmdArgs, Inputs, Output));
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148383.513752.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230414/f12184c8/attachment.bin>


More information about the cfe-commits mailing list