[Toybox] [PATCH] Improve file(1)'s ELF support.

enh enh at google.com
Sat Jul 2 13:01:54 PDT 2016


Read any PT_NOTE sections to look for NT_GNU_BUILD_ID or Android API
level notes. I deliberately didn't NT_GNU_ABI_TAG because it's noisy --
every Linux executable has one -- but not something most command-line
users will have any use for. (And you can ask readelf(1) anyway.)

Also read the section headers to implement "stripped"/"not stripped".

This patch removes "uses %d libs" because it was actually just counting
dynamic sections in the ELF file, and there are only 0 or 1 of those in
a valid ELF flie. (If you really want this functionality, you have to
*parse* the dynamic section looking for the DT_NEEDED entries. But that's
more of a job for readelf(1) than file(1).)
---
 toys/pending/file.c | 125 ++++++++++++++++++++++++++++++++++------------------
 1 file changed, 82 insertions(+), 43 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Improve-file-1-s-ELF-support.patch
Type: text/x-patch
Size: 7112 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20160702/cbed0b6a/attachment-0003.bin>


More information about the Toybox mailing list