This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] SEGV whilst placing sections
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Mark Shinwell <shinwell at codesourcery dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 21 Jun 2006 00:34:38 +0930
- Subject: Re: [PATCH] SEGV whilst placing sections
- References: <44980174.6020000@codesourcery.com>
On Tue, Jun 20, 2006 at 03:08:52PM +0100, Mark Shinwell wrote:
> In this case, the "after" parameter to lang_insert_orphan () corresponds
> to the .rodata section, the last in the linked list of "asection"s.
> The upshot is that place->section points at the "next" entry of the final
> section in the list, .rodata. This "next" pointer is NULL, so "as" ends up
> NULL, and we fault when "as->prev" is computed.
> + if (!as)
> + {
> + /* Put the section at the end of the list. */
Isn't the section already at the end of the list in this case?
> + /* Unlink the section. */
> + bfd_section_list_remove (output_bfd, snew);
> +
> + /* Now tack it back on in the right place. */
> + bfd_section_list_append (output_bfd, snew);
> + }
> + else if (as != snew && as->prev != snew)
So really all you need to do is change the condition to
if (as != snew && as != NULL && as->prev != snew)
--
Alan Modra
IBM OzLabs - Linux Technology Centre