This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] SEGV whilst placing sections
On Tue, Jun 20, 2006 at 07:26:37PM +0100, Mark Shinwell wrote:
> Alan Modra wrote:
> > 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?
>
> Your fix works, so presumably it is, but I'm still slightly in the dark
I'd like to understand just how *place->section can be NULL, so I'm a
little in the dark too. If everything is working as it should, then
*place->section should never be NULL. On entry to lang_insert_orphan,
place->section ought to either be NULL or pointing at one of the next
pointers in the list of sections attached to output_bfd. A new output
section will always be created at the end of the list of sections
attached to output_bfd, so that ought to make *place->section non-NULL.
I can only think that we aren't creating a new output section for the
orphan for some reason, or that an output section has been detached from
the list somehow.
Can you make a testcase available for people who don't have an arm
compiler handy?
--
Alan Modra
IBM OzLabs - Linux Technology Centre