From 74af50134b5f26677f8b787662bee9bda158d068 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 14 Mar 2014 07:04:01 +0000 Subject: [PATCH] [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 --- lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp index 8898746a78b6..980eec74051f 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp @@ -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(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(sym->SectionNumber), sec)) return ec; if (_merge.count(sec))