Index: ELF/Config.h =================================================================== --- ELF/Config.h +++ ELF/Config.h @@ -101,6 +101,7 @@ bool SysvHash = true; bool Threads; bool Trace; + bool UseWindowsRsp; bool Verbose; bool VersionScriptGlobalByDefault = true; bool WarnCommon; Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -358,6 +358,7 @@ Config->StripDebug = Args.hasArg(OPT_strip_debug); Config->Threads = Args.hasArg(OPT_threads); Config->Trace = Args.hasArg(OPT_trace); + Config->UseWindowsRsp = Args.hasArg(OPT_use_windows_rsp); Config->Verbose = Args.hasArg(OPT_verbose); Config->WarnCommon = Args.hasArg(OPT_warn_common); Index: ELF/DriverUtils.cpp =================================================================== --- ELF/DriverUtils.cpp +++ ELF/DriverUtils.cpp @@ -58,7 +58,10 @@ // Expand response files. '@' is replaced by the file's contents. SmallVector Vec(Argv.data(), Argv.data() + Argv.size()); StringSaver Saver(Alloc); - cl::ExpandResponseFiles(Saver, cl::TokenizeGNUCommandLine, Vec); + cl::TokenizerCallback TC = (Config->UseWindowsRsp) + ? cl::TokenizeWindowsCommandLine + : cl::TokenizeGNUCommandLine; + cl::ExpandResponseFiles(Saver, TC, Vec); // Parse options and then do error checking. opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount); Index: ELF/Options.td =================================================================== --- ELF/Options.td +++ ELF/Options.td @@ -156,6 +156,9 @@ def unresolved_symbols: J<"unresolved-symbols=">, HelpText<"Determine how to handle unresolved symbols">; +def use_windows_rsp: F<"use-windows-rsp">, + HelpText<"Use Windows rules for parsing response files">; + def verbose: F<"verbose">, HelpText<"Verbose mode">; def version: F<"version">, HelpText<"Display the version number">; Index: test/ELF/basic.s =================================================================== --- test/ELF/basic.s +++ test/ELF/basic.s @@ -190,6 +190,11 @@ # RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \ # RUN: | FileCheck %s +# Test for response file (Windows rules) +# RUN: echo " c:\blah\foo" > %t.responsefile +# RUN: not ld.lld --use-windows-rsp %t @%t.responsefile 2>&1 | FileCheck %s --check-prefix=WINRSP +# WINRSP: cannot open c:\blah\foo + # RUN: not ld.lld %t.foo -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=MISSING %s # MISSING: cannot open {{.*}}.foo: {{[Nn]}}o such file or directory