From 55a6e762ee7c89ae7ba952095ffa09f037e7cd97 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 25 Jul 2014 22:28:49 +0000 Subject: [PATCH] [PECOFF] Add /profile command line option. llvm-svn: 213984 --- lld/lib/Driver/WinLinkDriver.cpp | 7 +++++++ lld/lib/Driver/WinLinkOptions.td | 1 + lld/unittests/DriverTests/WinLinkDriverTest.cpp | 11 +++++++++++ 3 files changed, 19 insertions(+) diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp index 0e51ca4..66fbcb2 100644 --- a/lld/lib/Driver/WinLinkDriver.cpp +++ b/lld/lib/Driver/WinLinkDriver.cpp @@ -1162,6 +1162,13 @@ bool WinLinkDriver::parse(int argc, const char *argv[], ctx.setSwapRunFromNet(true); break; + case OPT_profile: + // /profile implies /opt:ref, /opt:noicf, /incremental:no and /fixed:no. + ctx.setDeadStripping(true); + ctx.setBaseRelocationEnabled(false); + ctx.setDynamicBaseEnabled(false); + break; + case OPT_implib: ctx.setOutputImportLibraryPath(inputArg->getValue()); break; diff --git a/lld/lib/Driver/WinLinkOptions.td b/lld/lib/Driver/WinLinkOptions.td index 8988b60..f31ae10 100644 --- a/lld/lib/Driver/WinLinkOptions.td +++ b/lld/lib/Driver/WinLinkOptions.td @@ -63,6 +63,7 @@ def verbose : F<"verbose">; def debug : F<"debug">; def swaprun_cd : F<"swaprun:cd">; def swaprun_net : F<"swaprun:net">; +def profile : F<"profile">; def force : F<"force">, HelpText<"Allow undefined symbols when creating executables">; diff --git a/lld/unittests/DriverTests/WinLinkDriverTest.cpp b/lld/unittests/DriverTests/WinLinkDriverTest.cpp index ef36f8c..c713b9c 100644 --- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp +++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp @@ -652,6 +652,17 @@ TEST_F(WinLinkParserTest, OptUnknown) { } // +// Test for /PROFILE +// + +TEST_F(WinLinkParserTest, Profile) { + EXPECT_TRUE(parse("link.exe", "/profile", "a.obj", nullptr)); + EXPECT_TRUE(_context.deadStrip()); + EXPECT_FALSE(_context.getBaseRelocationEnabled()); + EXPECT_FALSE(_context.getDynamicBaseEnabled()); +} + +// // Test for command line flags that are ignored. // -- 2.7.4