[PATCH] SEGV whilst placing sections
Mark Shinwell
shinwell@codesourcery.com
Tue Jun 20 14:46:00 GMT 2006
The following C code, when compiled for an ARM target with -fexceptions
and linked using the attached linker script, causes SEGV in
lang_insert_orphan () when placing the .ARM.extab section.
int f(int *);
int g(void)
{
int a;
return f(&a);
}
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.
The attached patch fixes this problem, and doesn't cause any test
failures -- but I'm not 100% sure this is the correct thing to do.
Perhaps someone who knows the code could tell me if they think this is
reasonable?
Thanks,
Mark
--
ld/ChangeLog:
2006-06-20 Mark Shinwell <shinwell@codesourcery.com>
* ldlang.c (lang_insert_orphan): Correctly handle the case where
the section is to end up after the section currently at the end
of the list in output_bfd.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: section-placing.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20060620/1b3ce5ec/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vmlinux.lds
URL: <https://sourceware.org/pipermail/binutils/attachments/20060620/1b3ce5ec/attachment-0001.ksh>
More information about the Binutils
mailing list