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

llvm-svn: 183724
This commit is contained in:
Rui Ueyama 2013-06-11 04:52:14 +00:00
parent 66ad574f40
commit daadcc59ad
3 changed files with 14 additions and 0 deletions

View File

@ -254,6 +254,10 @@ bool WinLinkDriver::parse(int argc, const char *argv[],
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());

View File

@ -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>;

View File

@ -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, HeapReserveAndCommit) {
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