bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/5900] ELF files with more than 65536 sections not handled corre


From: ian at airs dot com
Subject: [Bug gas/5900] ELF files with more than 65536 sections not handled correctly.
Date: 10 Mar 2008 17:09:50 -0000

------- Additional Comments From ian at airs dot com  2008-03-10 17:09 -------
I compiled the original test case with icc 8.1.  I ran readelf -s.  Here are
some excerpts:

 65279: 00000000     0 SECTION LOCAL  DEFAULT 65278 section_65270
 65280: 00000000     0 SECTION LOCAL  DEFAULT 65279 section_65271
 65281: 00000000     0 SECTION LOCAL  DEFAULT PRC[0xff00] section_65272
 65282: 00000000     0 SECTION LOCAL  DEFAULT PRC[0xff01] section_65273
 65283: 00000000     0 SECTION LOCAL  DEFAULT PRC[0xff02] section_65274

 65521: 00000000     0 SECTION LOCAL  DEFAULT RSV[0xfff0] section_65512
 65522: 00000000     0 SECTION LOCAL  DEFAULT  ABS section_65513
 65523: 00000000     0 SECTION LOCAL  DEFAULT  COM section_65514
 65524: 00000000     0 SECTION LOCAL  DEFAULT RSV[0xfff3] section_65515

 65536: 00000000     0 SECTION LOCAL  DEFAULT RSV[0xffff] section_65527
 65537: 00000000     0 SECTION LOCAL  DEFAULT  UND section_65528
 65538: 00000000     0 SECTION LOCAL  DEFAULT    1 section_65529
 65539: 00000000     0 SECTION LOCAL  DEFAULT    2 section_65530

135280: 00000000     4 OBJECT  GLOBAL DEFAULT 65278 var_65270
135281: 00000000     4 OBJECT  GLOBAL DEFAULT 65279 var_65271
135282: 00000000     4 OBJECT  GLOBAL DEFAULT PRC[0xff00] var_65272
135283: 00000000     4 OBJECT  GLOBAL DEFAULT PRC[0xff01] var_65273
135284: 00000000     4 OBJECT  GLOBAL DEFAULT PRC[0xff02] var_65274

135522: 00000000     4 OBJECT  GLOBAL DEFAULT RSV[0xfff0] var_65512
135523: 00000000     4 OBJECT  GLOBAL DEFAULT  ABS var_65513
135524: 00000000     4 OBJECT  GLOBAL DEFAULT  COM var_65514
135525: 00000000     4 OBJECT  GLOBAL DEFAULT RSV[0xfff3] var_65515

135537: 00000000     4 OBJECT  GLOBAL DEFAULT RSV[0xffff] var_65527
135538: 00000000     4 OBJECT  GLOBAL DEFAULT  UND var_65528
135539: 00000000     4 OBJECT  GLOBAL DEFAULT    1 var_65529


Then I compiled the same test case with gcc 4.2.1 and GNU binutils 2.17.50 (a
snapshot).  Here are some excerpts from readelf -s:

 65279: 00000000     0 SECTION LOCAL  DEFAULT 65278 
 65280: 00000000     0 SECTION LOCAL  DEFAULT 65279 
 65281: 00000000     0 SECTION LOCAL  DEFAULT 65536 
 65282: 00000000     0 SECTION LOCAL  DEFAULT 65537 
 65283: 00000000     0 SECTION LOCAL  DEFAULT 65538 

135281: 00000000     4 OBJECT  GLOBAL DEFAULT 65278 var_65275
135282: 00000000     4 OBJECT  GLOBAL DEFAULT 65279 var_65276
135283: 00000000     4 OBJECT  GLOBAL DEFAULT 65536 var_65277
135284: 00000000     4 OBJECT  GLOBAL DEFAULT 65537 var_65278
135285: 00000000     4 OBJECT  GLOBAL DEFAULT 65538 var_65279
135286: 00000000     4 OBJECT  GLOBAL DEFAULT 65539 var_65280

135518: 00000000     4 OBJECT  GLOBAL DEFAULT 65771 var_65512
135519: 00000000     4 OBJECT  GLOBAL DEFAULT 65772 var_65513
135520: 00000000     4 OBJECT  GLOBAL DEFAULT 65773 var_65514
135521: 00000000     4 OBJECT  GLOBAL DEFAULT 65774 var_65515
135522: 00000000     4 OBJECT  GLOBAL DEFAULT 65775 var_65516

Note that readelf is written to expect the output of gas.  Note that it does not
work correctly for the output of icc.  icc follows the ELF ABI.  gas does not.

For another test, I tried the elfutils.  Running eu-readelf -s on the object
file generated by gcc gives me this:

eu-readelf: invalid sh_link value in section 70007

In other words, the elfutils agree with icc and with the ELF ABI.  They do not
agree with the GNU binutils.


> I think it is up for debate. I can see the point for the current BFD
> behavior. That is each section index is unique, including special
> ones. When I say section index 0xfff2, there is no ambiguity about
> which section it refers to.

If we follow the ELF ABI, each section index is still unique.  The section
indexes are simply the consecutive non-negative numbers up to but not including
the number of sections.  The values from SHN_LORESERVE to SHN_HIRESERVER are not
section indexes.  They are special codes which must be interpreted specially.

-- 


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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]