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

Nico Rieck nico.rieck at gmail.com
Sun Mar 16 18:49:33 PDT 2014

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.


More information about the llvm-commits mailing list