[lld] r200029 - [PECOFF] Accept /machine:x64 option.
Rui Ueyama
ruiu at google.com
Fri Jan 24 11:17:05 PST 2014
Author: ruiu
Date: Fri Jan 24 13:17:05 2014
New Revision: 200029
URL: http://llvm.org/viewvc/llvm-project?rev=200029&view=rev
Log:
[PECOFF] Accept /machine:x64 option.
This is the first patch to support PE32+ format, which is the image format
to use 64 bit address space on Windows/x86-64.
Modified:
lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
Modified: lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=200029&r1=200028&r2=200029&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Fri Jan 24 13:17:05 2014
@@ -79,6 +79,10 @@ public:
virtual bool
createImplicitFiles(std::vector<std::unique_ptr<File> > &result) const;
+ bool is64Bit() const {
+ return _machineType == llvm::COFF::IMAGE_FILE_MACHINE_AMD64;
+ }
+
void appendInputSearchPath(StringRef dirPath) {
_inputSearchPaths.push_back(dirPath);
}
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=200029&r1=200028&r2=200029&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Fri Jan 24 13:17:05 2014
@@ -73,9 +73,10 @@ bool PECOFFLinkingContext::validateImpl(
return false;
}
- // Architectures other than i386 is not supported yet.
- if (_machineType != llvm::COFF::IMAGE_FILE_MACHINE_I386) {
- diagnostics << "Machine type other than x86 is not supported.\n";
+ // Architectures other than x86/x64 is not supported yet.
+ if (_machineType != llvm::COFF::IMAGE_FILE_MACHINE_I386 &&
+ _machineType != llvm::COFF::IMAGE_FILE_MACHINE_AMD64) {
+ diagnostics << "Machine type other than x86/x64 is not supported.\n";
return false;
}
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=200029&r1=200028&r2=200029&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Fri Jan 24 13:17:05 2014
@@ -217,9 +217,14 @@ TEST_F(WinLinkParserTest, MachineX86) {
}
TEST_F(WinLinkParserTest, MachineX64) {
- EXPECT_FALSE(parse("link.exe", "/machine:x64", "a.obj", nullptr));
- EXPECT_TRUE(StringRef(errorMessage())
- .startswith("Machine type other than x86 is not supported"));
+ EXPECT_TRUE(parse("link.exe", "/machine:x64", "a.obj", nullptr));
+ EXPECT_EQ(llvm::COFF::IMAGE_FILE_MACHINE_AMD64, _context.getMachineType());
+}
+
+TEST_F(WinLinkParserTest, MachineArm) {
+ EXPECT_FALSE(parse("link.exe", "/machine:arm", "a.obj", nullptr));
+ EXPECT_TRUE(StringRef(errorMessage()).startswith(
+ "Machine type other than x86/x64 is not supported"));
}
TEST_F(WinLinkParserTest, MajorImageVersion) {
More information about the llvm-commits
mailing list