MC: Add support for BigObj

Teach WinCOFFObjectWriter how to write -mbig-obj style object files;
these object files allow for more sections inside an object file.

Our support for BigObj is notably different from binutils and cl: we
implicitly upgrade object files to BigObj instead of asking the user to
compile the same file *again* but with another flag.  This matches up
with how LLVM treats ELF variants.

This was tested by forcing LLVM to always emit BigObj files and running
the entire test suite.  A specific test has also been added.

I've lowered the maximum number of sections in a normal COFF file,
VS "14" CTP 3 supports no more than 65279 sections.  This is important
otherwise we might not switch to BigObj quickly enough, leaving us with
a COFF file that we couldn't link.

yaml2obj support is all that remains to implement.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217812 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2014-09-15 19:42:42 +00:00
parent 46738fc43e
commit f1198da05c
7 changed files with 141 additions and 89 deletions

View File

@ -790,12 +790,14 @@ void COFFDumper::printSymbol(const SymbolRef &Sym) {
if (error(getSymbolAuxData(Obj, Symbol, I, Aux)))
break;
int32_t AuxNumber = Aux->getNumber(Symbol.isBigObj());
DictScope AS(W, "AuxSectionDef");
W.printNumber("Length", Aux->Length);
W.printNumber("RelocationCount", Aux->NumberOfRelocations);
W.printNumber("LineNumberCount", Aux->NumberOfLinenumbers);
W.printHex("Checksum", Aux->CheckSum);
W.printNumber("Number", Aux->Number);
W.printNumber("Number", AuxNumber);
W.printEnum("Selection", Aux->Selection, makeArrayRef(ImageCOMDATSelect));
if (Section && Section->Characteristics & COFF::IMAGE_SCN_LNK_COMDAT
@ -803,13 +805,13 @@ void COFFDumper::printSymbol(const SymbolRef &Sym) {
const coff_section *Assoc;
StringRef AssocName;
std::error_code EC;
if ((EC = Obj->getSection(Aux->Number, Assoc)) ||
if ((EC = Obj->getSection(AuxNumber, Assoc)) ||
(EC = Obj->getSectionName(Assoc, AssocName))) {
AssocName = "";
error(EC);
}
W.printNumber("AssocSection", AssocName, Aux->Number);
W.printNumber("AssocSection", AssocName, AuxNumber);
}
} else if (Symbol.isCLRToken()) {
const coff_aux_clr_token *Aux;