Update readelf to v2.37, adapt readelf.py output and tests (#387)
Changes to conform the output of readelf.py to binutils readelf v2.37:
- Use singular "entry" when needed instead of "entries".
- Output the last entry for the .debug_line output table when
DW_LNE_end_sequence is encountered, as DWARF standard dictates. Looks
looks like this was a readelf bug which was fixed in commit
ba8826a82a29a19b78c18ce4f44fe313de279af7 of the GNU binutils-gdb repo.
- Add additional "Stmt" field in the .debug_line output table, and
ignore the new "View" field. The "Stmt" field has been implemented in
readelf.py. The "View" field is not something that the DWARF standard
defines, it's an internal register added to the line number
information state machine by binutils to perform assembler checks (see
commit
ba8826a82a29a19b78c18ce4f44fe313de279af7 of GNU binutils-gdb
repo for more info, in particular gas/doc/as.texinfo). "View" is
unimplemented in pyelftools for now and a special case has been added
in the readelf test suite to ignore it.
- Add support for printing section names when dumping .symtab entries of
st_type STT_SECTION as readelf v2.37 does (see commit
23356397449a8aa65afead0a895a20be53b3c6b0 of GNU binutils-gdb repo).
- Add suport for recognizing SOs specifically tagged as PIE (DT_FLAGS_1
dynamic tag with DF_1_PIE set). In such case, describe the file as
"Position-Independent Executable file" instead of "Shared object
file", as readelf v2.37 does.
- Add leading "0x" for version section addresses when dumping version
information (-V) as readelf does.
- Ignore "D (mbind)" in section headers flags legend (pyelftools does
not output this flag).
Special cases ADDED for run_readelf_tests.py:
- Ignore "View" column for --debug-dump=decodedline in readelf's output.
- Ignore ellipsis ("[...]") for long names/symbols/paths in readelf's
output.
Special cases REMOVED for run_readelf_tests.py:
- Detection of additional '@' after symbol names (flag_after_symtable)
seems to no longer be needed as all tests pass whitout this exception.
- Special case for DW_AT_apple_xxx seems to no longer be needed, readelf
now recognizes those.
- Special case for PT_GNU_PROPERTY no longer needed, readelf now
recognizes it.
Other changes:
- Add missing import in elftools/dwarf/lineprogram.py.
References:
- GNU binutils-gdb repo: https://sourceware.org/git/?p=binutils-gdb.git