summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp7
-rw-r--r--lld/lib/Driver/WinLinkOptions.td1
-rw-r--r--lld/unittests/DriverTests/WinLinkDriverTest.cpp11
3 files changed, 19 insertions, 0 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index 0e51ca40141..66fbcb2e4da 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 8988b60f87f..f31ae10a259 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 ef36f8c86d0..c713b9c3e5d 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.
//
OpenPOWER on IntegriCloud