This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: More than 65536 sections in an ELF file

Andreas Schwab <> writes:

> Ian Lance Taylor <> writes:
>> So what I expect to see is that the section header at index 0 will
>> have an sh_size field of 70010 and an sh_link field of 70006.  What I
>> see in fact is an sh_size field of 70010 and an sh_link field of
>> 70262.  That is because BFD has added SHN_HIRESERVE - SHN_LORESERVE ==
>> 256 to the section number of the section name string table.  70006 +
>> 256 == 70262.
> But the index numbers SHN_LORESERVE to SHN_HIRESERVE have a special
> meaning, eg. a st_shndx of SHN_COMMON means that the symbol is a common
> symbol.  How would you distinguish that from a symbol in section number
> 65522?  The only way to do that is to skip the 256 logical indexes from
> 0xFF00 to 0xFFFF.

Any symbol whose natural section index is >= SHN_LORESERVE will have
SHN_XINDEX in the st_shndx field.  So if the natural section index is
65522, the st_shndx field will be SHN_XINDEX, and the corresponding
entry in the SHT_SYMTAB_SHNDX section will be 65522.  No confusion is


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]