[PATCH] strip: Ignore --reloc-debug-sections-only for non-ET_REL files.
Mark Wielaard
mark@klomp.org
Wed Nov 6 23:32:50 GMT 2024
Hi Aaron,
On Wed, Nov 06, 2024 at 04:15:30PM -0500, Aaron Merey wrote:
> On Wed, Nov 6, 2024 at 2:35 PM Mark Wielaard <mark@klomp.org> wrote:
> > > if (reloc_debug_only)
> > > {
> > > + if (ehdr->e_type != ET_REL)
> > > + {
> > > + /* Only ET_REL files should have debug relocations to remove. */
> > > + error (0, 0, _("Ignoring --reloc-debug-sections-only for " \
> > > + "non-ET_REL file '%s'"), fname);
> > > + goto fail_close;
> > > + }
> >
> > Do we have to fail here? I think it is nicer for the user to just
> > turn this into an warning with
> >
> > if (ehdr->e_type != ET_REL) else if (handle_debug_relocs (...))
>
> If we don't fail then strip will need to do more work copying sections
> over to the 'newelf' handle in order to properly overwrite the input file
> with newelf.
>
> Since --reloc-debug-sections-only should be a no-op for non-ET_REL files
> it makes sense to skip that extra work and avoid overwriting the input file.
Aha, so by not goto done you skip the actual (supposed to do nothing)
work. goto fail_close isn't so much "failing", but more about closing
without doing any more work. Which is fine because when
--reloc-debug-sections-only "No other stripping is performed".
OK. Sorry for being dense.
Cheers,
Mark
More information about the Elfutils-devel
mailing list