Use this script to create an C/C++ file which will have more than 65536 sections:
for i in `seq 1 70000`; do echo "int var_$i __attribute__((section(\"section_$i\"))) = $i;" done Compile it. Run readelf -S on the resulting object file. Note section 0: [ 0] NULL 0000000000000000 00000000 000000000001117a 0000000000000000 70262 0 0 When there are more than 65536 sections, the ELF spec says that sh_size should hold the number of sections. When the section string table index is more than 0xff00, it should be in the sh_link field. Here we see that sh_size is 0x1117a == 70010. sh_link is 70262. This does not make sense as 70262 > 70010. What is happening is that whenever BFD needs to store a section index larger than 0xff00, it stores the section number plus 256. Thus in this case the section string table index is really 70262 - 256 == 70006. BFD is self-consistent, and readelf is consistent with what BFD generates. But the output does not follow the ELF spec. -- Summary: ELF files with more than 65536 sections not handled correctly. Product: binutils Version: 2.16 Status: NEW Severity: normal Priority: P2 Component: gas AssignedTo: unassigned at sources dot redhat dot com ReportedBy: ian at airs dot com CC: bug-binutils at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=5900 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils