This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: More than 65536 sections in an ELF file
- From: Ian Lance Taylor <iant at google dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: binutils at sourceware dot org
- Date: Sat, 08 Mar 2008 14:04:55 -0800
- Subject: Re: More than 65536 sections in an ELF file
- References: <m3od9qf4pv.fsf@google.com> <jey78tr3pj.fsf@sykes.suse.de>
Andreas Schwab <schwab@suse.de> writes:
> Ian Lance Taylor <iant@google.com> 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
possible.
Ian