forked from OSchip/llvm-project
[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. llvm-svn: 218344
This commit is contained in:
parent
75c0127bb3
commit
251d9a34e2
|
@ -192,7 +192,6 @@ static llvm::COFF::MachineTypes stringToMachineType(StringRef str) {
|
||||||
// However, given that LLVM only supports ARM NT, default to that for now.
|
// However, given that LLVM only supports ARM NT, default to that for now.
|
||||||
return llvm::StringSwitch<llvm::COFF::MachineTypes>(str.lower())
|
return llvm::StringSwitch<llvm::COFF::MachineTypes>(str.lower())
|
||||||
.Case("arm", llvm::COFF::IMAGE_FILE_MACHINE_ARMNT)
|
.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("x64", llvm::COFF::IMAGE_FILE_MACHINE_AMD64)
|
||||||
.Case("x86", llvm::COFF::IMAGE_FILE_MACHINE_I386)
|
.Case("x86", llvm::COFF::IMAGE_FILE_MACHINE_I386)
|
||||||
.Default(llvm::COFF::IMAGE_FILE_MACHINE_UNKNOWN);
|
.Default(llvm::COFF::IMAGE_FILE_MACHINE_UNKNOWN);
|
||||||
|
|
|
@ -74,16 +74,6 @@ bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {
|
||||||
return false;
|
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);
|
_writer = createWriterPECOFF(*this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,6 +221,11 @@ TEST_F(WinLinkParserTest, MachineArm) {
|
||||||
EXPECT_EQ(llvm::COFF::IMAGE_FILE_MACHINE_ARMNT, _context.getMachineType());
|
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) {
|
TEST_F(WinLinkParserTest, MajorImageVersion) {
|
||||||
EXPECT_TRUE(parse("link.exe", "/version:7", "foo.o", nullptr));
|
EXPECT_TRUE(parse("link.exe", "/version:7", "foo.o", nullptr));
|
||||||
EXPECT_EQ(7, _context.getImageVersion().majorVersion);
|
EXPECT_EQ(7, _context.getImageVersion().majorVersion);
|
||||||
|
|
Loading…
Reference in New Issue