[PATCH] D62876: [LLD] [MinGW] Support the -u/--undefined option.

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 8 11:23:32 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL362882: [MinGW] Support the -u/--undefined option. (authored by mstorsjo, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62876?vs=203428&id=203702#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62876

Files:
  lld/trunk/MinGW/Driver.cpp
  lld/trunk/MinGW/Options.td
  lld/trunk/test/MinGW/driver.test


Index: lld/trunk/MinGW/Options.td
===================================================================
--- lld/trunk/MinGW/Options.td
+++ lld/trunk/MinGW/Options.td
@@ -46,6 +46,10 @@
     HelpText<"Omit all symbol information from the output binary">;
 def strip_debug: F<"strip-debug">,
     HelpText<"Omit all debug information, but keep symbol information">;
+def undefined: S<"u">,
+    HelpText<"Include symbol in the link, if available">;
+def undefined_long: S<"undefined">, Alias<undefined>;
+def undefined_eq: J<"undefined=">, Alias<undefined>;
 def whole_archive: F<"whole-archive">,
     HelpText<"Include all object files for following archives">;
 def v: Flag<["-"], "v">, HelpText<"Display the version number">;
Index: lld/trunk/MinGW/Driver.cpp
===================================================================
--- lld/trunk/MinGW/Driver.cpp
+++ lld/trunk/MinGW/Driver.cpp
@@ -269,6 +269,8 @@
 
   for (auto *A : Args.filtered(OPT_require_defined))
     Add("-include:" + StringRef(A->getValue()));
+  for (auto *A : Args.filtered(OPT_undefined))
+    Add("-includeoptional:" + StringRef(A->getValue()));
 
   std::vector<StringRef> SearchPaths;
   for (auto *A : Args.filtered(OPT_L)) {
Index: lld/trunk/test/MinGW/driver.test
===================================================================
--- lld/trunk/test/MinGW/driver.test
+++ lld/trunk/test/MinGW/driver.test
@@ -157,6 +157,9 @@
 RUN: ld.lld -### foo.o -m i386pe -require-defined _foo --require-defined _bar -require-defined=_baz --require-defined=_foo2 | FileCheck -check-prefix=REQUIRE-DEFINED %s
 REQUIRE-DEFINED: -include:_foo -include:_bar -include:_baz -include:_foo2
 
+RUN: ld.lld -### foo.o -m i386pe -u _foo --undefined _bar -undefined=_baz --undefined=_foo2 | FileCheck -check-prefix=UNDEFINED %s
+UNDEFINED: -includeoptional:_foo -includeoptional:_bar -includeoptional:_baz -includeoptional:_foo2
+
 RUN: ld.lld -### -m i386pep foo.o -Llibpath | FileCheck -check-prefix LIBPATH %s
 LIBPATH: -libpath:libpath
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62876.203702.patch
Type: text/x-patch
Size: 2000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190608/809a3ed8/attachment.bin>


More information about the llvm-commits mailing list