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: hjl dot tools at gmail dot com
Subject: [Bug gas/5900] ELF files with more than 65536 sections not handled correctly.
Date: 8 Mar 2008 23:40:29 -0000

------- Additional Comments From hjl dot tools at gmail dot com  2008-03-08 
23:40 -------
>From gABI:

sh_size Unspecified If non-zero, the actual number of section header entries
sh_link Unspecified If non-zero, the index of the section header string table
section

sh_link has a section index, which can be > number of sections. Consider


bash-3.2$ cat y.c
int conststaticvariable;
bash-3.2$ gcc -c y.c -m32
bash-3.2$ readelf -Ss y.o
There are 9 section headers, starting at offset 0xa8:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 000034 000000 00  AX  0   0  4
  [ 2] .data             PROGBITS        00000000 000034 000000 00  WA  0   0  4
  [ 3] .bss              NOBITS          00000000 000034 000000 00  WA  0   0  4
  [ 4] .comment          PROGBITS        00000000 000034 00002e 00      0   0  1
  [ 5] .note.GNU-stack   PROGBITS        00000000 000062 000000 00      0   0  1
  [ 6] .shstrtab         STRTAB          00000000 000062 000045 00      0   0  1
  [ 7] .symtab           SYMTAB          00000000 000210 000080 10      8   7  4
  [ 8] .strtab           STRTAB          00000000 000290 000019 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Symbol table '.symtab' contains 8 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 FILE    LOCAL  DEFAULT  ABS y.c
     2: 00000000     0 SECTION LOCAL  DEFAULT    1
     3: 00000000     0 SECTION LOCAL  DEFAULT    2
     4: 00000000     0 SECTION LOCAL  DEFAULT    3
     5: 00000000     0 SECTION LOCAL  DEFAULT    5
     6: 00000000     0 SECTION LOCAL  DEFAULT    4
     7: 00000004     4 OBJECT  GLOBAL DEFAULT  COM conststaticvariable
bash-3.2$

y.o only have 9 sections. However, the section index of conststaticvariable
is 0xfff2, which is > 9. That is because the section indexes from 0xfff2
to 0xfff2 don't have entries in section header table. st_shndx is section
index, which isn't the same as the index of the section header table.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl dot tools at gmail dot
                   |                            |com


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]