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

Rui Ueyama ruiu at google.com
Fri Mar 14 00:04:02 PDT 2014


Author: ruiu
Date: Fri Mar 14 02:04:01 2014
New Revision: 203901

URL: http://llvm.org/viewvc/llvm-project?rev=203901&view=rev
Log:
[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.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=203901&r1=203900&r2=203901&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Fri Mar 14 02:04:01 2014
@@ -477,7 +477,8 @@ error_code FileCOFF::createDefinedSymbol
       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::cacheSectionAttribu
       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))





More information about the llvm-commits mailing list