summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp9
-rw-r--r--lld/lib/Driver/WinLinkOptions.td1
-rw-r--r--lld/unittests/DriverTests/WinLinkDriverTest.cpp8
3 files changed, 18 insertions, 0 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index ed4c4d9467a..ff0cb3b00e4 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -314,6 +314,15 @@ bool WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ct
ctx.setHeapCommit(commit);
break;
}
+ case OPT_machine: {
+ StringRef platform = inputArg->getValue();
+ if (!platform.equals_lower("x64")) {
+ diagnostics << "error: LLD does not support non-x64 platform, "
+ << "but got /machine:" << platform << "\n";
+ return true;
+ }
+ break;
+ }
case OPT_subsystem: {
// Parse /subsystem command line option. The form of /subsystem is
// "subsystem_name[,majorOSVersion[.minorOSVersion]]".
diff --git a/lld/lib/Driver/WinLinkOptions.td b/lld/lib/Driver/WinLinkOptions.td
index 0003198dad2..53883fab3ee 100644
--- a/lld/lib/Driver/WinLinkOptions.td
+++ b/lld/lib/Driver/WinLinkOptions.td
@@ -19,6 +19,7 @@ defm libpath : P<"libpath", "Additional library search path">;
defm mllvm : P<"mllvm", "Options to pass to LLVM">;
defm out : P<"out", "Path to file to write output">;
defm stack : P<"stack", "Size of the stack">;
+defm machine : P<"machine", "Specify target platform">;
defm subsystem : P<"subsystem", "Specify subsystem">;
// We cannot use multiclass P because class name "incl" is different
diff --git a/lld/unittests/DriverTests/WinLinkDriverTest.cpp b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
index 6aa1e60e588..533d349cfa9 100644
--- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp
+++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
@@ -106,6 +106,14 @@ TEST_F(WinLinkParserTest, Libpath) {
EXPECT_EQ("dir2", paths[1]);
}
+TEST_F(WinLinkParserTest, MachineX64) {
+ EXPECT_FALSE(parse("link.exe", "/machine:x64", "a.obj", nullptr));
+}
+
+TEST_F(WinLinkParserTest, MachineArm) {
+ EXPECT_TRUE(parse("link.exe", "/machine:arm", "a.obj", nullptr));
+}
+
TEST_F(WinLinkParserTest, MinMajorOSVersion) {
EXPECT_FALSE(parse("link.exe", "/subsystem:windows,3", "foo.o", nullptr));
EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_GUI, _context.getSubsystem());
OpenPOWER on IntegriCloud