RFC: Change readelf/objdump to automatically follow debug links

Mark Wielaard mark@klomp.org
Mon Mar 1 14:22:51 GMT 2021


Hi,

On Mon, 2021-03-01 at 13:53 +0000, Nick Clifton wrote:
> > But secondly it combines this with dumping sections from the linked
> > files itself (intermixed with dumping the sections of the actual input
> > file). This might be useful to some users, but is very confusion for
> > tools relying on just dumping (debug) sections from specific file. The
> > dwz and debugedit testsuites get very confused by this. And it causes
> > bugs like PR27486 and PR27478
> > 
> > Could these features be split (--follow-links vs --dump-links) with the
> > first possibly being made the default and the second only on request of
> > the user?
> 
> I think that this is already done.  Ie =follow-links is on by default
> but =dump-links is off by default.  (The =dump-links option just displays
> the contents of link sections, it does not mean 'show the contents of
> sections in linked files').

Ah, unfortunate, I didn't mean the existing dump-links option (which I
forgot about). I meant to suggest a new option that made clear we
explicitly wanted to dump sections from linked files, not just display
data referenced by the main object file that happens to have a link to
it.

>  From what you have said however it sounds as if users want readelf to
> follow links, and display the contents of sections in linked files, only
> if this has been explicitly requested.  (Or possibly only when processing
> debugging info is some way).  But there is a problem: the change to
> following debug links by default came about because objdump's disassembler
> was not taking advantage of the symbol tables in debug info files.  So
> for some non-debug-info related tasks we do want to follow the links and
> load the files, but for others we do not.  I am not sure how this can
> resolved.

Right, I think that is the confusing consequence of the option. It was
meant to dump data in a way to showed auxiliary data from linked files.
But for readelf it doesn't just do that, but also dumps sections from
the linked files itself. I think the second usage needs its own option
(that is off by default).

e.g. I think it is fine if follow-links implies that objdump shows
disassambly with addresses resolved to symbols from linked files, or
have readelf show strings for a supplemental file for
DW_FORM_GNU_alt_strp. But that shouldn't imply dumping the section/data
from the linked file(s) themselves.

Cheers,

Mark


More information about the Binutils mailing list