[PATCH] D138065: [ELF] Handle GCC collect2 -plugin-opt= on Windows

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 09:59:04 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcf4f35b78871: [ELF] Handle GCC collect2 -plugin-opt= on Windows (authored by bwerl, committed by tejohnson).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138065/new/

https://reviews.llvm.org/D138065

Files:
  lld/ELF/Driver.cpp
  lld/test/ELF/lto-plugin-ignore.s


Index: lld/test/ELF/lto-plugin-ignore.s
===================================================================
--- lld/test/ELF/lto-plugin-ignore.s
+++ lld/test/ELF/lto-plugin-ignore.s
@@ -8,7 +8,9 @@
 # RUN: ld.lld %t.o -o /dev/null \
 # RUN:   -plugin path/to/liblto_plugin.so \
 # RUN:   -plugin-opt=/path/to/lto-wrapper \
+# RUN:   -plugin-opt=/path/to/lto-wrapper.exe \
 # RUN:   -plugin-opt=relative/path/to/lto-wrapper \
+# RUN:   -plugin-opt=relative/path/to/lto-wrapper.exe \
 # RUN:   -plugin-opt=-fresolution=zed \
 # RUN:   -plugin-opt=-pass-through=-lgcc \
 # RUN:   -plugin-opt=-pass-through=-lgcc_eh \
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -1360,12 +1360,15 @@
     parseClangOption(std::string("-") + arg->getValue(), arg->getSpelling());
 
   // GCC collect2 passes -plugin-opt=path/to/lto-wrapper with an absolute or
-  // relative path. Just ignore. If not ended with "lto-wrapper", consider it an
+  // relative path. Just ignore. If not ended with "lto-wrapper" (or
+  // "lto-wrapper.exe" for GCC cross-compiled for Windows), consider it an
   // unsupported LLVMgold.so option and error.
-  for (opt::Arg *arg : args.filtered(OPT_plugin_opt_eq))
-    if (!StringRef(arg->getValue()).endswith("lto-wrapper"))
+  for (opt::Arg *arg : args.filtered(OPT_plugin_opt_eq)) {
+    StringRef v(arg->getValue());
+    if (!v.endswith("lto-wrapper") && !v.endswith("lto-wrapper.exe"))
       error(arg->getSpelling() + ": unknown plugin option '" + arg->getValue() +
             "'");
+  }
 
   config->passPlugins = args::getStrings(args, OPT_load_pass_plugins);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138065.475855.patch
Type: text/x-patch
Size: 1681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221116/1198883b/attachment.bin>


More information about the llvm-commits mailing list