This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: section .init_array not working on ppc32


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]