[llvm] r203986 - Object/COFF: change data type of SymbolNumber from int16 to uint16.

Rui Ueyama ruiu at google.com
Mon Mar 17 14:08:18 PDT 2014


I created a .cc file containing lots of extern inline functions to see
what's the upper limit on number of COFF sections that CL.exe can create.
It shows the following error message when it hits 65300 sections.

  fatal error C1128: number of sections exceeded object file format limit :
compile with /bigobj

So it looks like the number of section in COFF needs to be <65300.


On Mon, Mar 17, 2014 at 1:03 PM, Rui Ueyama <ruiu at google.com> wrote:

> I will add a function isReservedSectionNumber() to check if it's one of
> UNDEFINED, ABSOLUTE or DEBUG sections.
>
>
> On Mon, Mar 17, 2014 at 12:03 AM, David Majnemer <david.majnemer at gmail.com
> > wrote:
>
>> IMAGE_SYM_SECTION_MAX is defined as 0xFEFF which means that the valid
>> range is from 1 to 65279.
>>
>>
>> On Sun Mar 16 2014 at 6:51:25 PM, Nico Rieck <nico.rieck at gmail.com>
>> wrote:
>>
>>> On 15.03.2014 01:04, Rui Ueyama wrote:
>>> > Author: ruiu
>>> > Date: Fri Mar 14 19:04:08 2014
>>> > New Revision: 203986
>>> >
>>> > URL: http://llvm.org/viewvc/llvm-project?rev=203986&view=rev
>>> > Log:
>>> > Object/COFF: change data type of SymbolNumber from int16 to uint16.
>>> >
>>> > Microsoft PE/COFF Spec clearly states that the field is of signed
>>> interger
>>> > type. However, in reality, it's unsigned. If cl.exe needs to create a
>>> large
>>> > number of sections for COMDAT sections, it will just create more than
>>> 32768
>>> > sections. Handling large section number as negative number is not
>>> correct.
>>> > I think this is a spec bug.
>>> >
>>> > Differential Revision: http://llvm-reviews.chandlerc.com/D3088
>>> >
>>> > Modified:
>>> >     llvm/trunk/include/llvm/Object/COFF.h
>>> >     llvm/trunk/include/llvm/Support/COFF.h
>>> >     llvm/trunk/test/MC/COFF/feat00.s
>>> >     llvm/trunk/test/MC/COFF/weak.s
>>> >     llvm/trunk/tools/llvm-nm/llvm-nm.cpp
>>>
>>> No test?
>>>
>>> This is also missing a few more spots where checks assume a signed
>>> section number (in COFFObjectFile::getSymbolType,
>>> COFFObjectFile::getSymbolSize and llvm-readobj COFFDumper::printSymbol).
>>>
>>> These checks shouldn't really be done this way and instead use a helper
>>> function to determine whether the section number is an index.
>>>
>>> -Nico
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140317/aa1d03a0/attachment.html>


More information about the llvm-commits mailing list