[PECOFF] Add /profile command line option.
authorRui Ueyama <ruiu@google.com>
Fri, 25 Jul 2014 22:28:49 +0000 (22:28 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 25 Jul 2014 22:28:49 +0000 (22:28 +0000)
llvm-svn: 213984

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

index 0e51ca4..66fbcb2 100644 (file)
@@ -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;
index 8988b60..f31ae10 100644 (file)
@@ -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">;
index ef36f8c..c713b9c 100644 (file)
@@ -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.
 //