RFC: Detecting debuginfo files
Nick Clifton
nickc@redhat.com
Wed Jun 26 17:08:00 GMT 2019
Hi Guys,
PR 24717 reports a problem with objcopy producing an unhelpful warning
message when copying a debuginfo file. The issue is that these files
do not strictly conform to the ELF standard, so whilst the warning is
technically correct, it is nonetheless misleading.
I have created a patch (attached) to add a function to the BFD library
to detect debuginfo files, and then use this function to suppress the
warning message. The function is intentionally made public so that
other users of the BFD library can access it if they need to.
The detection function currently uses a simple heuristic - any file
whose allocated sections are only of the SHT_NOBITS or SHT_NOTE types
are assumed to be debuginfo files. My intention is that if a new
heuristic comes along, or - better - a standard is agreed for marking
such files, then the function can be updated to suit.
I have however been unable to come up with a good way to test the
patch. Creating a debuginfo file with the required properties is not
easy as objcopy's --only-keep-debug option does not suffice. (It
does not put the .note.gnu.property section outside of a loadable
segment). It turns out that in real life, well Fedora life anyway,
debuginfo files are created by a whole series of steps involving both
eu-strip, objcopy, nm and readelf. So my question is, apart from
having any comments on the patch, does anyone have any ideas for a
simple way to create a slightly non-conformant debuginfo file ? :-)
Cheers
Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: detect-debuginfo-files.patch
Type: text/x-patch
Size: 2280 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20190626/350a8d9f/attachment.bin>
More information about the Binutils
mailing list