[PECOFF] Handle large objects having more than 32768 sections.

The COFF spec says that the SectionNumber field in the symbol table is 16 bit
signed type, but MSVC treats the field as if it is unsigned.

llvm-svn: 203901
This commit is contained in:
Rui Ueyama 2014-03-14 07:04:01 +00:00
parent 048baca082
commit 74af50134b
1 changed files with 4 additions and 2 deletions

View File

@ -477,7 +477,8 @@ error_code FileCOFF::createDefinedSymbols(const SymbolVectorT &symbols,
continue;
const coff_section *sec;
if (error_code ec = _obj->getSection(sym->SectionNumber, sec))
if (error_code ec =
_obj->getSection(static_cast<uint16_t>(sym->SectionNumber), sec))
return ec;
assert(sec && "SectionIndex > 0, Sec must be non-null!");
@ -526,7 +527,8 @@ error_code FileCOFF::cacheSectionAttributes() {
continue;
const coff_section *sec;
if (error_code ec = _obj->getSection(sym->SectionNumber, sec))
if (error_code ec =
_obj->getSection(static_cast<uint16_t>(sym->SectionNumber), sec))
return ec;
if (_merge.count(sec))