section .init_array not working on ppc32

Alan Modra amodra@bigpond.net.au
Thu Mar 13 11:19:00 GMT 2003


On Thu, Mar 13, 2003 at 11:01:00AM +0100, Olaf Hering wrote:
> I'm not sure if that is a binutils or gcc bug, testcase is from glibc
> configure:
> 
> nectarine:~# gcc -o conftest conftest.c  -static -nostartfiles -nostdlib
> nectarine:~# ./conftest
> Segmentation fault
> nectarine:~# cat conftest.c
> int _start (void) { return 0; }
> int __start (void) { return 0; }
> int foo (void) { return 1; }
> int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;

It's a glibc configure bug.  You can make this obvious by reducing
your conftest.c to just the first line, when the testcase compiles
and links to just

_start:
 li r3,0
 blr

Since lr is initialized by the kernel to zero, the blr jumps to
zero.  Boom.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list