According to the ELF standard:
e_shstrndx
This member holds the section header table index of the entry associated with 
the section name string table. If the file has no section name string table, 
this member holds the value SHN_UNDEF. See 
``Sections''<http://www.sco.com/developers/gabi/latest/ch4.sheader.html> and 
``String Table''<http://www.sco.com/developers/gabi/latest/ch4.strtab.html> 
below for more information.

If the section name string table section index is greater than or equal to 
SHN_LORESERVE (0xff00), this member has the value SHN_XINDEX (0xffff) and the 
actual index of the section name string table section is contained in the 
sh_link field of the section header at index 0. (Otherwise, the sh_link member 
of the initial entry contains 0.)
The current readelf -h seems to assume that if there are more than 0xff00 
sections, then the shstrndx will also be past that.  But there is nothing to 
prevent the section name string table from being section 1, in which case 
e_shstrndx should just be 1.  But the readelf implementation has:
               else if (elf_header.e_shstrndx != SHN_UNDEF && 
elf_header.e_shstrndx >= elf_header.e_shnum)
                   printf(_("<corrupt: out of range>"));











_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to