summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/include/lld/ReaderWriter/PECOFFLinkingContext.h6
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp8
-rw-r--r--lld/lib/Driver/WinLinkOptions.td2
-rw-r--r--lld/unittests/DriverTests/WinLinkDriverTest.cpp9
4 files changed, 24 insertions, 1 deletions
diff --git a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
index b9b70fb5317..d1508841cc3 100644
--- a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
+++ b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
@@ -169,6 +169,11 @@ public:
void setManifestUiAccess(std::string val) { _manifestUiAccess = val; }
const std::string &getManifestUiAccess() const { return _manifestUiAccess; }
+ void setManifestDependency(std::string val) { _manifestDependency = val; }
+ const std::string &getManifestDependency() const {
+ return _manifestDependency;
+ }
+
void setImageType(ImageType type) { _imageType = type; }
ImageType getImageType() const { return _imageType; }
@@ -233,6 +238,7 @@ private:
int _manifestId;
std::string _manifestLevel;
std::string _manifestUiAccess;
+ std::string _manifestDependency;
ImageType _imageType;
// The set to store /nodefaultlib arguments.
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index d6f6f3da638..37e5de58b65 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -500,6 +500,14 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx,
ctx.setManifestOutputPath(ctx.allocateString(inputArg->getValue()));
break;
+ case OPT_manifestdependency:
+ // /manifestdependency:<string> option. Note that the argument will be
+ // embedded to the manifest XML file with no error check, for link.exe
+ // compatibility. We do not gurantete that the resulting XML file is
+ // valid.
+ ctx.setManifestDependency(ctx.allocateString(inputArg->getValue()));
+ break;
+
case OPT_failifmismatch:
if (handleFailIfMismatchOption(inputArg->getValue(), failIfMismatchMap,
diagnostics))
diff --git a/lld/lib/Driver/WinLinkOptions.td b/lld/lib/Driver/WinLinkOptions.td
index 373061f5c1a..1a87cea2968 100644
--- a/lld/lib/Driver/WinLinkOptions.td
+++ b/lld/lib/Driver/WinLinkOptions.td
@@ -35,6 +35,8 @@ 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">;
+def manifestdependency : P<"manifestdependency",
+ "Attributes for <dependency> in manifest file">;
// 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 4ce33896081..50b6c544ad1 100644
--- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp
+++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
@@ -62,6 +62,7 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_TRUE(_context.getDynamicBaseEnabled());
EXPECT_TRUE(_context.getCreateManifest());
EXPECT_EQ("a.exe.manifest", _context.getManifestOutputPath());
+ EXPECT_EQ("", _context.getManifestDependency());
EXPECT_FALSE(_context.getEmbedManifest());
EXPECT_EQ(1, _context.getManifestId());
EXPECT_EQ("'asInvoker'", _context.getManifestLevel());
@@ -373,7 +374,7 @@ TEST_F(WinLinkParserTest, FailIfMismatch_Mismatch) {
}
//
-// Tests for /manifest, /manifestuac, and /manifestfile.
+// Tests for /manifest, /manifestuac, /manifestfile, and /manifestdependency.
//
TEST_F(WinLinkParserTest, Manifest_Default) {
EXPECT_TRUE(parse("link.exe", "/manifest", "a.out", nullptr));
@@ -434,6 +435,12 @@ TEST_F(WinLinkParserTest, Manifestfile) {
EXPECT_EQ("bar.manifest", _context.getManifestOutputPath());
}
+TEST_F(WinLinkParserTest, Manifestdependency) {
+ EXPECT_TRUE(parse("link.exe", "/manifestdependency:foo bar", "a.out",
+ nullptr));
+ EXPECT_EQ("foo bar", _context.getManifestDependency());
+}
+
//
// Test for command line flags that are ignored.
//
OpenPOWER on IntegriCloud