This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld --as-needed assertion fail, BFD internal error and crash
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: "Dmitry V. Levin" <ldv at altlinux dot org>, "H. J. Lu" <hjl at lucon dot org>, binutils at sourceware dot org
- Date: Thu, 16 Mar 2006 09:54:02 +1030
- Subject: Re: ld --as-needed assertion fail, BFD internal error and crash
- References: <20060315172001.GA13434@basalt.office.altlinux.org> <44185661.8050603@redhat.com>
On Wed, Mar 15, 2006 at 06:01:05PM +0000, Nick Clifton wrote:
> Hi Dmitry,
>
> >While building random packages with ld --as-needed to evaluate this
> >extension, I found few cases where ld fails within BFD:
> >http://sources.redhat.com/bugzilla/show_bug.cgi?id=2434
> >Looks like --as-needed is not widely used and therefore not tested well.
>
> The attached patch appears to fix this problem, but I am not sure that
> it is the correct solution.
>
> H.J. - would you care to comment ? Should we be ignoring
> bfd_link_hash_new type symbols in the way that the patch proposes or is
> it wrong that such symbols reach this point in the code ?
The hash_new syms are no doubt the result of elf_smash_syms trying to
undo symbol table state after finding that a shared lib wasn't needed.
I haven't looked at the testcase under gdb, but I wouldn't be surprised
to find that the problem can't be fixed without a rewrite of the
as-needed code. Trying to undo symbol table state is fragile, to say
the least. We probably ought to be doing two passes over symbols from
an as-needed lib, first time to see if the library is needed, then do
the normal processing only if we find the library is in fact needed.
--
Alan Modra
IBM OzLabs - Linux Technology Centre