[lld] r183724 - [WinLink] Add -force command line option to allow undefined symbols.

Rui Ueyama ruiu at google.com
Mon Jun 10 21:52:14 PDT 2013


Author: ruiu
Date: Mon Jun 10 23:52:14 2013
New Revision: 183724

URL: http://llvm.org/viewvc/llvm-project?rev=183724&view=rev
Log:
[WinLink] Add -force command line option to allow undefined symbols.

Modified:
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/lib/Driver/WinLinkOptions.td
    lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=183724&r1=183723&r2=183724&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Mon Jun 10 23:52:14 2013
@@ -254,6 +254,10 @@ bool WinLinkDriver::parse(int argc, cons
   if (llvm::opt::Arg *arg = parsedArgs->getLastArg(OPT_entry))
     info.setEntrySymbolName(arg->getValue());
 
+  // Handle -force
+  if (parsedArgs->getLastArg(OPT_force))
+    info.setAllowRemainingUndefines(true);
+
   // Hanlde -out
   if (llvm::opt::Arg *outpath = parsedArgs->getLastArg(OPT_out))
     info.setOutputPath(outpath->getValue());

Modified: lld/trunk/lib/Driver/WinLinkOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkOptions.td?rev=183724&r1=183723&r2=183724&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkOptions.td (original)
+++ lld/trunk/lib/Driver/WinLinkOptions.td Mon Jun 10 23:52:14 2013
@@ -25,5 +25,8 @@ def entry : Separate<["-", "/"], "entry"
     HelpText<"Name of entry point symbol">;
 def entry_c: Joined<["-", "/"], "entry:">, Alias<entry>;
 
+def force : Flag<["-", "/"], "force">,
+    HelpText<"Allow undefined symbols when creating executables">;
+
 def help : Flag<["-", "/"], "help">;
 def help_q : Flag<["-", "/"], "?">, Alias<help>;

Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=183724&r1=183723&r2=183724&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Mon Jun 10 23:52:14 2013
@@ -46,6 +46,7 @@ TEST_F(WinLinkParserTest, Basic) {
   EXPECT_EQ(0, info->getMinOSVersion().minorVersion);
   EXPECT_EQ(1024 * 1024, info->getStackReserve());
   EXPECT_EQ(4096, info->getStackCommit());
+  EXPECT_FALSE(info->allowRemainingUndefines());
 }
 
 TEST_F(WinLinkParserTest, WindowsStyleOption) {
@@ -108,4 +109,10 @@ TEST_F(WinLinkParserTest, HeapReserveAnd
   EXPECT_EQ(16384, info->getHeapReserve());
   EXPECT_EQ(8192, info->getHeapCommit());
 }
+
+TEST_F(WinLinkParserTest, Force) {
+  parse("link.exe", "-force", nullptr);
+  EXPECT_TRUE(info->allowRemainingUndefines());
+}
+
 }  // end anonymous namespace





More information about the llvm-commits mailing list