[lld] r218344 - [PECOFF] Simplify /machine option handling
Rui Ueyama
ruiu at google.com
Tue Sep 23 17:21:45 PDT 2014
Author: ruiu
Date: Tue Sep 23 19:21:45 2014
New Revision: 218344
URL: http://llvm.org/viewvc/llvm-project?rev=218344&view=rev
Log:
[PECOFF] Simplify /machine option handling
/machine:ebc was previously recognized but rejected. Unknown architecture
names were handled differently but eventually rejected too. We don't need
to distinguish them.
Modified:
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
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=218344&r1=218343&r2=218344&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Tue Sep 23 19:21:45 2014
@@ -192,7 +192,6 @@ static llvm::COFF::MachineTypes stringTo
// However, given that LLVM only supports ARM NT, default to that for now.
return llvm::StringSwitch<llvm::COFF::MachineTypes>(str.lower())
.Case("arm", llvm::COFF::IMAGE_FILE_MACHINE_ARMNT)
- .Case("ebc", llvm::COFF::IMAGE_FILE_MACHINE_EBC)
.Case("x64", llvm::COFF::IMAGE_FILE_MACHINE_AMD64)
.Case("x86", llvm::COFF::IMAGE_FILE_MACHINE_I386)
.Default(llvm::COFF::IMAGE_FILE_MACHINE_UNKNOWN);
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=218344&r1=218343&r2=218344&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Tue Sep 23 19:21:45 2014
@@ -74,16 +74,6 @@ bool PECOFFLinkingContext::validateImpl(
return false;
}
- switch (_machineType) {
- case llvm::COFF::IMAGE_FILE_MACHINE_I386:
- case llvm::COFF::IMAGE_FILE_MACHINE_AMD64:
- case llvm::COFF::IMAGE_FILE_MACHINE_ARMNT:
- break;
- default:
- diagnostics << "Machine type other than arm/x86/x86_64 is not supported.\n";
- return false;
- }
-
_writer = createWriterPECOFF(*this);
return true;
}
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=218344&r1=218343&r2=218344&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Tue Sep 23 19:21:45 2014
@@ -221,6 +221,11 @@ TEST_F(WinLinkParserTest, MachineArm) {
EXPECT_EQ(llvm::COFF::IMAGE_FILE_MACHINE_ARMNT, _context.getMachineType());
}
+TEST_F(WinLinkParserTest, MachineUnknown) {
+ EXPECT_FALSE(parse("link.exe", "/machine:nosucharch", "a.obj", nullptr));
+ EXPECT_EQ("error: unknown machine type: nosucharch\n", errorMessage());
+}
+
TEST_F(WinLinkParserTest, MajorImageVersion) {
EXPECT_TRUE(parse("link.exe", "/version:7", "foo.o", nullptr));
EXPECT_EQ(7, _context.getImageVersion().majorVersion);
More information about the llvm-commits
mailing list