diff --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp --- a/lld/MachO/DriverUtils.cpp +++ b/lld/MachO/DriverUtils.cpp @@ -82,7 +82,9 @@ // Expand response files (arguments in the form of @) // and then parse the argument again. - cl::ExpandResponseFiles(saver, cl::TokenizeGNUCommandLine, vec); + checkError( + cl::ExpandResponseFilesWithError(saver, cl::TokenizeGNUCommandLine, vec)); + InputArgList args = ParseArgs(vec, missingIndex, missingCount); // Handle -fatal_warnings early since it converts missing argument warnings diff --git a/lld/test/MachO/reproduce.s b/lld/test/MachO/reproduce.s --- a/lld/test/MachO/reproduce.s +++ b/lld/test/MachO/reproduce.s @@ -53,6 +53,11 @@ # RUN: cd repro2; ld64.lld @response.txt +## Error case +# RUN: mkdir -p %t.dir/errors && cd $t.dir/errors && rm -rf foo.txt +# RUN: not %lld @foo.txt 2>&1 | FileCheck %s --check-prefix=NOFILE +# NOFILE: error: Error expanding response file: No such file or directory + .globl _main _main: ret