This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH] strip: Don't remove real symbols from allocated symbol tables.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 12 Oct 2016 14:49:22 +0200
- Subject: Re: [PATCH] strip: Don't remove real symbols from allocated symbol tables.
On Thu, 2016-10-06 at 11:53 -0700, Josh Stone wrote:
> On 10/06/2016 07:18 AM, Mark Wielaard wrote:
> > Having a symbol in an allocated symbol table (like .dynsym) that
> > points to an unallocated section is wrong. Traditionally strip
> > has removed such symbols if they are section or group symbols.
> > But removing a real symbol from an allocate symbol table is hard
> > and probably a mistake. Really removing it means rewriting the
> > dynamic segment and hash sections. Since we don't do that, don't
> > remove the symbol (and corrupt the ELF file). Do warn and set
> > the symbol section to SHN_UNDEF.
> >
> > https://bugzilla.redhat.com/show_bug.cgi?id=1380961
> >
> > Signed-off-by: Mark Wielaard <mjw@redhat.com>
>
> Works for me. On the test from bugzilla, I get the expected warning:
>
> strip: Cannot remove symbol [1550] from allocated symbol table [3]
>
> but ldd is perfectly happy with the result.
>
> I also tried it with a manual "objcopy -R .rustc" beforehand, which I
> will probably do in the rpm to prevent that section from even being
> saved to debuginfo -- just discard it entirely. Strip still works with
> the same warning and a working result.
Thanks for testing. It also has been in Fedora rawhide for some time
now. I pushed it to master.
Cheers,
Mark