[PATCH] D111110: [lld][ELF] Check for errors when the response file doesn't exist.

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 4 19:54:08 PDT 2021


oontvoo created this revision.
oontvoo added a reviewer: thakis.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: MaskRay.
oontvoo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The ExpandResponseFile function could return an error when it failed to expand the file (because it doens't exist or it's not readable, etc).
The caller should check for that rather than ignoring the return value then later on trying to load the @file.txt as an input file

similar change has also been made to lld-macho


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111110

Files:
  lld/ELF/DriverUtils.cpp


Index: lld/ELF/DriverUtils.cpp
===================================================================
--- lld/ELF/DriverUtils.cpp
+++ lld/ELF/DriverUtils.cpp
@@ -125,7 +125,9 @@
 
   // Expand response files (arguments in the form of @<filename>)
   // and then parse the argument again.
-  cl::ExpandResponseFiles(saver, getQuotingStyle(args), vec);
+  checkError(
+      cl::ExpandResponseFilesWithError(saver, getQuotingStyle(args), vec));
+
   concatLTOPluginOptions(vec);
   args = this->ParseArgs(vec, missingIndex, missingCount);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111110.377073.patch
Type: text/x-patch
Size: 536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/2653049f/attachment.bin>


More information about the llvm-commits mailing list