diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp --- a/lld/MinGW/Driver.cpp +++ b/lld/MinGW/Driver.cpp @@ -436,5 +436,8 @@ std::vector vec; for (const std::string &s : linkArgs) vec.push_back(s.c_str()); + // Pass the actual binary name, to make error messages be printed with + // the right prefix. + vec[0] = argsArr[0]; return coff::link(vec, canExitEarly, stdoutOS, stderrOS); } diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test --- a/lld/test/MinGW/driver.test +++ b/lld/test/MinGW/driver.test @@ -102,7 +102,7 @@ WHOLE-ARCHIVE: foo.o -wholearchive:bar.a baz.a RUN: ld.lld -### -m i386pep foo.o | FileCheck -check-prefix MINGW-FLAG %s -MINGW-FLAG: -lldmingw +MINGW-FLAG: lld-link -lldmingw RUN: ld.lld -### -m i386pep foo.o --exclude-all-symbols | FileCheck -check-prefix EXCLUDE-ALL %s RUN: ld.lld -### -m i386pep foo.o -exclude-all-symbols | FileCheck -check-prefix EXCLUDE-ALL %s