[PATCH] D144084: [LLD] [COFF] Don't try to detect MSVC installations in mingw mode
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 21 12:54:31 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG241c290ad73f: Reland [LLD] [COFF] Don't try to detect MSVC installations in mingw mode (authored by mstorsjo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144084/new/
https://reviews.llvm.org/D144084
Files:
lld/COFF/Driver.cpp
lld/test/COFF/winsysroot.test
Index: lld/test/COFF/winsysroot.test
===================================================================
--- lld/test/COFF/winsysroot.test
+++ lld/test/COFF/winsysroot.test
@@ -49,5 +49,12 @@
NO32: could not open 'std32.lib'
Check that when /winsysroot is specified, %LIB% is ignored.
-# RUN: env LIB=foo.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x86 not lld-link %t.obj /winsysroot:%t.dir/doesnotexist /defaultlib:std32 2>&1 | FileCheck -check-prefix=LIBIGNORED %s
+# RUN: env LIB=%t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x86 not lld-link %t.obj /winsysroot:%t.dir/doesnotexist /defaultlib:std32 2>&1 | FileCheck -check-prefix=LIBIGNORED %s
LIBIGNORED: could not open 'std32.lib'
+
+Check that when -lldmingw is specified, %LIB% is ignored.
+# RUN: env LIB=%t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x86 not lld-link -lldmingw %t.obj /defaultlib:std32 2>&1 | FileCheck -check-prefix=LIBIGNORED_MINGW %s
+LIBIGNORED_MINGW: could not open 'libstd32.a'
+
+# RUN: not lld-link -lldmingw %t.obj /defaultlib:std32 /winsysroot:%t.dir/sysroot 2>&1 | FileCheck -check-prefix=IGNORED_ARG %s
+IGNORED_ARG: warning: ignoring /vctoolsdir or /winsysroot flags in MinGW mode
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -1588,13 +1588,25 @@
{
llvm::TimeTraceScope timeScope2("Search paths");
searchPaths.emplace_back("");
- // Prefer the Clang provided builtins over the ones bundled with MSVC.
- addClangLibSearchPaths(argsArr[0]);
+ if (!config->mingw) {
+ // Prefer the Clang provided builtins over the ones bundled with MSVC.
+ // In MinGW mode, the compiler driver passes the necessary libpath
+ // options explicitly.
+ addClangLibSearchPaths(argsArr[0]);
+ }
for (auto *arg : args.filtered(OPT_libpath))
searchPaths.push_back(arg->getValue());
- detectWinSysRoot(args);
- if (!args.hasArg(OPT_lldignoreenv) && !args.hasArg(OPT_winsysroot))
- addLibSearchPaths();
+ if (!config->mingw) {
+ // Don't automatically deduce the lib path from the environment or MSVC
+ // installations when operating in mingw mode. (This also makes LLD ignore
+ // winsysroot and vctoolsdir arguments.)
+ detectWinSysRoot(args);
+ if (!args.hasArg(OPT_lldignoreenv) && !args.hasArg(OPT_winsysroot))
+ addLibSearchPaths();
+ } else {
+ if (args.hasArg(OPT_vctoolsdir, OPT_winsysroot))
+ warn("ignoring /vctoolsdir or /winsysroot flags in MinGW mode");
+ }
}
// Handle /ignore
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144084.557827.patch
Type: text/x-patch
Size: 2575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20231021/a1b85a99/attachment.bin>
More information about the llvm-commits
mailing list