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

Rob Landley rob at landley.net
Tue Jul 5 12:16:32 PDT 2016


On 07/04/2016 08:31 AM, Ed Maste wrote:
> On 2 July 2016 at 16:01, enh <enh at google.com> wrote:
>> 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.)
> 
> +          if (n_type == 3 /*NT_GNU_BUILD_ID*/) {
> +            printf(", BuildID[%s]=", (n_descsz==20)?"sha1":"md5");
> +            for (j = 0; j < n_descsz; ++j) printf("%02x", note[16 + j]);
> +          }
> 
> There are build ID notes that are not 20 bytes long, and are not md5.
> Specifically, a 16 byte build ID may be a UUID, LLVM's lld can
> generate 8-byte fnv1, and the user may specify an arbitrary number of
> hex bytes for build ID.

FYI this looks interesting but I'm not doing anything with it because
I'm not a regular user of this info and can't judge what's best to do
here. I leave turning this into a proper patch (or not) to... Elliott, I
guess?

> but given that there's no requirement on exactly what's included in a
> sha1 or md5 build ID anyway I'm not sure there's much value in
> reporting the type.

Exactly my problem: I dunno what success looks like here.

(What does NT GNU mean anyway? GNU/Windows NT?)

Rob


More information about the Toybox mailing list