Object: Add support for bigobj

This adds support for reading the "bigobj" variant of COFF produced by
cl's /bigobj and mingw's -mbig-obj.

The most significant difference that bigobj brings is more than 2**16
sections to COFF.

bigobj brings a few interesting differences with it:
- It doesn't have a Characteristics field in the file header.
- It doesn't have a SizeOfOptionalHeader field in the file header (it's
  only used in executable files).
- Auxiliary symbol records have the same width as a symbol table entry.
  Since symbol table entries are bigger, so are auxiliary symbol
  records.

Write support will come soon.

Differential Revision: http://reviews.llvm.org/D5259

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217496 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2014-09-10 12:51:52 +00:00
parent cfae729840
commit b3a86a097b
24 changed files with 630 additions and 314 deletions

View File

@ -260,11 +260,8 @@ static void printLoadConfiguration(const COFFObjectFile *Obj) {
if (!PE32Header)
return;
const coff_file_header *Header;
if (error(Obj->getCOFFHeader(Header)))
return;
// Currently only x86 is supported
if (Header->Machine != COFF::IMAGE_FILE_MACHINE_I386)
if (Obj->getMachine() != COFF::IMAGE_FILE_MACHINE_I386)
return;
const data_directory *DataDir;
@ -518,11 +515,7 @@ static void printRuntimeFunctionRels(const COFFObjectFile *Obj,
}
void llvm::printCOFFUnwindInfo(const COFFObjectFile *Obj) {
const coff_file_header *Header;
if (error(Obj->getCOFFHeader(Header)))
return;
if (Header->Machine != COFF::IMAGE_FILE_MACHINE_AMD64) {
if (Obj->getMachine() != COFF::IMAGE_FILE_MACHINE_AMD64) {
errs() << "Unsupported image machine type "
"(currently only AMD64 is supported).\n";
return;