[lld] r190121 - [PECOFF] Add /machine command line option.
Rui Ueyama
ruiu at google.com
Thu Sep 5 21:17:07 PDT 2013
Author: ruiu
Date: Thu Sep 5 23:17:07 2013
New Revision: 190121
URL: http://llvm.org/viewvc/llvm-project?rev=190121&view=rev
Log:
[PECOFF] Add /machine command line option.
Modified:
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/lib/Driver/WinLinkOptions.td
lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=190121&r1=190120&r2=190121&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Thu Sep 5 23:17:07 2013
@@ -314,6 +314,15 @@ bool WinLinkDriver::parse(int argc, cons
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]]".
Modified: lld/trunk/lib/Driver/WinLinkOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkOptions.td?rev=190121&r1=190120&r2=190121&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkOptions.td (original)
+++ lld/trunk/lib/Driver/WinLinkOptions.td Thu Sep 5 23:17:07 2013
@@ -19,6 +19,7 @@ defm libpath : P<"libpath", "Additional
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
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=190121&r1=190120&r2=190121&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Thu Sep 5 23:17:07 2013
@@ -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());
More information about the llvm-commits
mailing list