summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/include/lld/ReaderWriter/PECOFFLinkingContext.h6
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp12
-rw-r--r--lld/lib/Driver/WinLinkOptions.td1
-rw-r--r--lld/unittests/DriverTests/WinLinkDriverTest.cpp9
4 files changed, 27 insertions, 1 deletions
diff --git a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
index 0327cf0c0d6..b9b70fb5317 100644
--- a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
+++ b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
@@ -152,6 +152,11 @@ public:
void setCreateManifest(bool val) { _createManifest = val; }
bool getCreateManifest() const { return _createManifest; }
+ void setManifestOutputPath(std::string val) { _manifestOutputPath = val; }
+ const std::string &getManifestOutputPath() const {
+ return _manifestOutputPath;
+ }
+
void setEmbedManifest(bool val) { _embedManifest = val; }
bool getEmbedManifest() const { return _embedManifest; }
@@ -223,6 +228,7 @@ private:
bool _terminalServerAware;
bool _dynamicBaseEnabled;
bool _createManifest;
+ std::string _manifestOutputPath;
bool _embedManifest;
int _manifestId;
std::string _manifestLevel;
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index d4fb892b6e4..d6f6f3da638 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -496,6 +496,10 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx,
break;
}
+ case OPT_manifestfile:
+ ctx.setManifestOutputPath(ctx.allocateString(inputArg->getValue()));
+ break;
+
case OPT_failifmismatch:
if (handleFailIfMismatchOption(inputArg->getValue(), failIfMismatchMap,
diagnostics))
@@ -639,6 +643,14 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx,
ctx.setOutputPath(replaceExtension(ctx, path, ".exe"));
}
+ // Default name of the manifest file is "foo.exe.manifest" where "foo.exe" is
+ // the output path.
+ if (ctx.getManifestOutputPath().empty()) {
+ std::string path = ctx.outputPath();
+ path.append(".manifest");
+ ctx.setManifestOutputPath(ctx.allocateString(path));
+ }
+
// If the core linker already started, we need to explicitly call parse() for
// each input element, because the pass to parse input files in Driver::link
// has already done.
diff --git a/lld/lib/Driver/WinLinkOptions.td b/lld/lib/Driver/WinLinkOptions.td
index 9e1e6a4deb9..373061f5c1a 100644
--- a/lld/lib/Driver/WinLinkOptions.td
+++ b/lld/lib/Driver/WinLinkOptions.td
@@ -34,6 +34,7 @@ def subsystem : P<"subsystem", "Specify subsystem">;
def manifest : F<"manifest">;
def manifest_colon : P<"manifest", "Create manifest file">;
def manifestuac : P<"manifestuac", "User access control">;
+def manifestfile : P<"manifestfile", "Manifest file path">;
// We cannot use multiclass P because class name "incl" is different
// from its command line option name. We do this because "include" is
diff --git a/lld/unittests/DriverTests/WinLinkDriverTest.cpp b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
index 2fde737d8e8..4ce33896081 100644
--- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp
+++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
@@ -61,6 +61,7 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_TRUE(_context.isTerminalServerAware());
EXPECT_TRUE(_context.getDynamicBaseEnabled());
EXPECT_TRUE(_context.getCreateManifest());
+ EXPECT_EQ("a.exe.manifest", _context.getManifestOutputPath());
EXPECT_FALSE(_context.getEmbedManifest());
EXPECT_EQ(1, _context.getManifestId());
EXPECT_EQ("'asInvoker'", _context.getManifestLevel());
@@ -372,7 +373,7 @@ TEST_F(WinLinkParserTest, FailIfMismatch_Mismatch) {
}
//
-// Tests for /manifest and /manifestuac.
+// Tests for /manifest, /manifestuac, and /manifestfile.
//
TEST_F(WinLinkParserTest, Manifest_Default) {
EXPECT_TRUE(parse("link.exe", "/manifest", "a.out", nullptr));
@@ -427,6 +428,12 @@ TEST_F(WinLinkParserTest, Manifestuac_LevelAndUiAccess) {
EXPECT_EQ("'true'", _context.getManifestUiAccess());
}
+TEST_F(WinLinkParserTest, Manifestfile) {
+ EXPECT_TRUE(parse("link.exe", "/manifestfile:bar.manifest",
+ "a.out", nullptr));
+ EXPECT_EQ("bar.manifest", _context.getManifestOutputPath());
+}
+
//
// Test for command line flags that are ignored.
//
OpenPOWER on IntegriCloud