public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* section .init_array not working on ppc32
@ 2003-03-13 10:01 Olaf Hering
  2003-03-13 11:13 ` Andreas Schwab
  2003-03-13 11:19 ` Alan Modra
  0 siblings, 2 replies; 5+ messages in thread
From: Olaf Hering @ 2003-03-13 10:01 UTC (permalink / raw)
  To: binutils

Hi,

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;
nectarine:~# ld -v
GNU ld version 2.13.90 20030312
nectarine:~# gcc -v
Reading specs from /usr/lib/gcc-lib/powerpc-suse-linux/3.3/specs
Configured with: /usr/src/packages/BUILD/gcc-3.3-20030311/gcc-3.3-20030311/configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --disable-checking --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit powerpc-suse-linux
Thread model: posix
gcc version 3.3 20030312 (prerelease) (SuSE Linux)

That conftest does also segfault with gcc3.2.2 

-- 
A: No.
Q: Should I include quotations after my reply?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: section .init_array not working on ppc32
  2003-03-13 10:01 section .init_array not working on ppc32 Olaf Hering
@ 2003-03-13 11:13 ` Andreas Schwab
  2003-03-13 11:19 ` Alan Modra
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2003-03-13 11:13 UTC (permalink / raw)
  To: Olaf Hering; +Cc: binutils

Olaf Hering <olh@suse.de> writes:

|> Hi,
|> 
|> 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;

I think this needs support from the crtstuff, and ia64-linux* and
hppa64-hpux* are the only targets that do.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: section .init_array not working on ppc32
  2003-03-13 10:01 section .init_array not working on ppc32 Olaf Hering
  2003-03-13 11:13 ` Andreas Schwab
@ 2003-03-13 11:19 ` Alan Modra
  2003-03-13 12:45   ` Andreas Schwab
  1 sibling, 1 reply; 5+ messages in thread
From: Alan Modra @ 2003-03-13 11:19 UTC (permalink / raw)
  To: Olaf Hering; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: section .init_array not working on ppc32
  2003-03-13 11:19 ` Alan Modra
@ 2003-03-13 12:45   ` Andreas Schwab
  2003-03-13 15:13     ` Elias Athanasopoulos
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2003-03-13 12:45 UTC (permalink / raw)
  To: Olaf Hering; +Cc: binutils

Alan Modra <amodra@bigpond.net.au> writes:

|> 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

You are not supposed to execute this program.  It is only compiled to
look for existance of init_array support from the compiler.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: section .init_array not working on ppc32
  2003-03-13 12:45   ` Andreas Schwab
@ 2003-03-13 15:13     ` Elias Athanasopoulos
  0 siblings, 0 replies; 5+ messages in thread
From: Elias Athanasopoulos @ 2003-03-13 15:13 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Olaf Hering, binutils

On Thu, Mar 13, 2003 at 01:45:12PM +0100, Andreas Schwab wrote:
> Alan Modra <amodra@bigpond.net.au> writes:
> 
> |> 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
> 
> You are not supposed to execute this program.  It is only compiled to
> look for existance of init_array support from the compiler.

And this not only for ppc32. I can reproduce it on i586, too.

Elias

-- 
University of Athens			I bet the human brain 
Physics Department				is a kludge --Marvin Minsky 

	

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-03-13 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-13 10:01 section .init_array not working on ppc32 Olaf Hering
2003-03-13 11:13 ` Andreas Schwab
2003-03-13 11:19 ` Alan Modra
2003-03-13 12:45   ` Andreas Schwab
2003-03-13 15:13     ` Elias Athanasopoulos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).