[PATCH] SEGV whilst placing sections

Mark Shinwell shinwell@codesourcery.com
Wed Jun 21 16:29:00 GMT 2006


H. J. Lu wrote:
> On Wed, Jun 21, 2006 at 08:23:18AM +0100, Mark Shinwell wrote:
>> H. J. Lu wrote:
>>> On Tue, Jun 20, 2006 at 03:08:52PM +0100, Mark Shinwell wrote:
>>>> 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.
>>>>
>>> Can you provide a testcase in assembly so that people can check it
>>> with a cross binutils?
>> Attached is the output of compiling the above with -fexceptions.
>> Now the following link should segfault (linker script attached to previous
>> mail):
>>
>> arm-none-linux-gnueabi-as -o nonleaf.o nonleaf.s
>> arm-none-linux-gnueabi-ld -T vmlinux.lds -o nonleaf nonleaf.o
>>
>> Alan, is this test case ok for you?
>>
> 
> Can you create one for ld/testsuite/ld-arm?

I've just committed the patch, but I'll construct such a testcase
and circulate it.

Mark



More information about the Binutils mailing list