Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Make GNU style symbol printing invalid symbol section indexes match GNU readelf #42820

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR43850
Status NEW
Importance P normal
Reported by James Henderson (jh7370.2008@my.bristol.ac.uk)
Reported on 2019-10-30 09:58:39 -0700
Last modified on 2019-11-05 02:31:49 -0800
Version trunk
Hardware PC Windows NT
CC jh7370.2008@my.bristol.ac.uk, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
When a symbol's st_shndx value is invalid due to it being larger than the
number of sections, GNU readelf prints "bad section index[ XX]" for the section
index column (where XX is the raw value). This also applies if the value is
derived from the .symtab_shndx section:

C:\Work> readelf --symbols test.o

Symbol table '.symtab' contains 3 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 NOTYPE  LOCAL  DEFAULT bad section index[ 67] invalid
     2: 00000000     0 NOTYPE  LOCAL  DEFAULT bad section index[ 42] invalid_shndx

llvm-readelf prints simply the value (derived from the .symtab_shndx section if
appropriate).
Quuxplusone commented 4 years ago

For the record, the printing where there is no SYMTAB_SHNDX section for SHN_XINDEX st_shndx values is also incorrect (llvm-readelf emits an error, GNU readelf prints "RSV[0xffff]"). I am working on a fix for that issue currently.

Quuxplusone commented 4 years ago

https://reviews.llvm.org/D69671 addresses comment 1. I haven't attempted to address the other related issue from comment 0.

Quuxplusone commented 4 years ago

Commit ef85f47595a905475d3e7b8d1441ed69cb226d9c fixes the comment 1 issue.