Feature request: improved build-id generation
Andy Lutomirski
luto@kernel.org
Thu Mar 15 17:08:00 GMT 2018
On Thu, Mar 15, 2018 at 1:32 PM, Nick Clifton <nickc@redhat.com> wrote:
> Hi Mark,
>
>> That might be an interesting alternative. Could you use this for e.g.
>> inserting a .comment section fragment with an unique (version) string?
>> That would be stripped away, but should still count for the build-id
>> hash calculation.
>
...
>
> % gcc hello.c -Wl,comment.t
> % readelf -p.comment a.out
>
> String dump of section '.comment':
> [ 0] GCC: (GNU) 7.3.1 20180130 (Red Hat 7.3.1-2)
> [ 2c] GCC: (GNU) 7.2.1 20170915 (Red Hat 7.2.1-2)
> [ 58] ABC
>
> A simple perl or python script could be used to create the comment.t
> linker script fragment.
When you say 'stripped away', do you mean that 'strip' would remove
it? Neither plain strip nor 'strip -S' seem to be doing the job.
Sticking additional information in the object that affects the
build-id, shows up in the separate debug data, and does *not* show up
in the actual running ELF file seems quite handy. Then there could be
a tool that would take an ELF file, find its debug info, and parse out
the Fedora package name and version :)
--Andy
More information about the Binutils
mailing list