[lld] r341846 - [MinGW] Hook up the --require-defined option to -include:

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 10 10:41:40 PDT 2018


Author: mstorsjo
Date: Mon Sep 10 10:41:40 2018
New Revision: 341846

URL: http://llvm.org/viewvc/llvm-project?rev=341846&view=rev
Log:
[MinGW] Hook up the --require-defined option to -include:

Differential Revision: https://reviews.llvm.org/D51840

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

Modified: lld/trunk/MinGW/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/MinGW/Driver.cpp?rev=341846&r1=341845&r2=341846&view=diff
==============================================================================
--- lld/trunk/MinGW/Driver.cpp (original)
+++ lld/trunk/MinGW/Driver.cpp Mon Sep 10 10:41:40 2018
@@ -212,6 +212,9 @@ bool mingw::link(ArrayRef<const char *>
   else
     Add("-alternatename:__image_base__=__ImageBase");
 
+  for (auto *A : Args.filtered(OPT_require_defined))
+    Add("-include:" + StringRef(A->getValue()));
+
   std::vector<StringRef> SearchPaths;
   for (auto *A : Args.filtered(OPT_L))
     SearchPaths.push_back(A->getValue());

Modified: lld/trunk/MinGW/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/MinGW/Options.td?rev=341846&r1=341845&r2=341846&view=diff
==============================================================================
--- lld/trunk/MinGW/Options.td (original)
+++ lld/trunk/MinGW/Options.td Mon Sep 10 10:41:40 2018
@@ -40,6 +40,9 @@ def strip_debug: F<"strip-debug">,
 def whole_archive: F<"whole-archive">,
     HelpText<"Include all object files for following archives">;
 def verbose: F<"verbose">, HelpText<"Verbose mode">;
+def require_defined: S<"require-defined">,
+    HelpText<"Force symbol to be added to symbol table as an undefined one">;
+def require_defined_eq: J<"require-defined=">, Alias<require_defined>;
 
 // LLD specific options
 def _HASH_HASH_HASH : Flag<["-"], "###">,

Modified: lld/trunk/test/MinGW/driver.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/MinGW/driver.test?rev=341846&r1=341845&r2=341846&view=diff
==============================================================================
--- lld/trunk/test/MinGW/driver.test (original)
+++ lld/trunk/test/MinGW/driver.test Mon Sep 10 10:41:40 2018
@@ -145,3 +145,6 @@ RUN: ld.lld -### foo.o -m i386pep --Map
 RUN: ld.lld -### foo.o -m i386pep -Map=bar.map | FileCheck -check-prefix=MAP %s
 RUN: ld.lld -### foo.o -m i386pep --Map=bar.map | FileCheck -check-prefix=MAP %s
 MAP: -lldmap:bar.map
+
+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




More information about the llvm-commits mailing list