OSDN Git Service

Improve file(1)'s ELF support.
authorElliott Hughes <enh@google.com>
Sat, 2 Jul 2016 19:53:40 +0000 (12:53 -0700)
committerRob Landley <rob@landley.net>
Mon, 4 Jul 2016 03:12:30 +0000 (22:12 -0500)
commitc5e7ee27f606ed0bdb20d54e9de1a4adb56fc5d3
treebc6334757d07e40a8beb4537cfcb7e1871adb92a
parent746e565c097ed311ebb65842ac8a6527535993a7
Improve file(1)'s ELF support.

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