Many improvements to MIPS flags handling to make output consistent with GNU binutils...
authorAG <github@mzpqnxow.com>
Sun, 26 Nov 2017 13:57:43 +0000 (08:57 -0500)
committerEli Bendersky <eliben@users.noreply.github.com>
Sun, 26 Nov 2017 13:57:43 +0000 (05:57 -0800)
commitcd3edd2e793d110d26aaebb5f14112fd3b790744
tree110c9c602029bb03ce850e7bd641c67f38035db1
parent88144c45b0ba2dca0596bf11347a9cb394f14e70
Many improvements to MIPS flags handling to make output consistent with GNU binutils readelf + typo (#165)

* Add EF_MIPS_PIC for E_FLAGS for statically linked MIPS-I executable produced by MUSL

pyelftools picked up CPIC but not PIC

binutils readelf says:
  Flags:                             0x1007, noreorder, pic, cpic, o32, mips1

pyelftools said (before this change):
  Flags:                             0x1007, noreorder, cpic, o32, mips1

Reproduce with the binary available at:

https://github.com/mzpqnxow/embedded-toolkit/blob/master/prebuilt_static_bins/gdbserver/gdbserver-6.8-mips-i-rtl819x-lexra

* Fix order of fix, was "cpic, pic" needs to be "pic, cpic", reordered the if statement to address this

* - Improve reporting on MIPS flags, fix many inconsistencies with GNU binutils
- Fix `desrciption` typo that raises fatal exception when encountering an unknown ABI
- Add E_FLAGS_MASKS constants to simplify ABI logic

* Add masks for E_FLAGS to simplify ABI logic
elftools/elf/constants.py
scripts/readelf.py