Bug 12499

Summary: Changes to .init_array support breaks eglibc-2.11.2 on hppa-linux
Product: binutils Reporter: John David Anglin <danglin>
Component: ldAssignee: unassigned
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 2.22   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description John David Anglin 2011-02-18 03:49:27 UTC
...
CPP='gcc-4.4 -E -x c-header'    /home2/dave/debian/glibc/eglibc-2.11.2/build-tre
e/hppa-libc/elf/ld.so.1 --library-path /home2/dave/debian/glibc/eglibc-2.11.2/bu
ild-tree/hppa-libc:/home2/dave/debian/glibc/eglibc-2.11.2/build-tree/hppa-libc/m
ath:/home2/dave/debian/glibc/eglibc-2.11.2/build-tree/hppa-libc/elf:/home2/dave/
debian/glibc/eglibc-2.11.2/build-tree/hppa-libc/dlfcn:/home2/dave/debian/glibc/e
glibc-2.11.2/build-tree/hppa-libc/nss:/home2/dave/debian/glibc/eglibc-2.11.2/bui
ld-tree/hppa-libc/nis:/home2/dave/debian/glibc/eglibc-2.11.2/build-tree/hppa-lib
c/rt:/home2/dave/debian/glibc/eglibc-2.11.2/build-tree/hppa-libc/resolv:/home2/d
ave/debian/glibc/eglibc-2.11.2/build-tree/hppa-libc/crypt:/home2/dave/debian/gli
bc/eglibc-2.11.2/build-tree/hppa-libc/nptl /home2/dave/debian/glibc/eglibc-2.11.
2/build-tree/hppa-libc/sunrpc/rpcgen -Y ../scripts -c rpcsvc/bootparam_prot.x -o
 /home2/dave/debian/glibc/eglibc-2.11.2/build-tree/hppa-libc/sunrpc/xbootparam_p
rot.T
make[3]: *** [/home2/dave/debian/glibc/eglibc-2.11.2/build-tree/hppa-libc/sunrpc
/xbootparam_prot.stmp] Segmentation fault (core dumped)

Problem occurs in call_init trying to run constructors for newly built libc.so.6.

/home2/dave/debian/glibc/eglibc-2.11.2/build-tree/hppa-libc/libc.so.6:
+file 
format elf32-hppa-linux

Contents of section .init_array:
159008 ffffffff 0015bee2 00000000           ............    

The ffffffff and 00000000 appear to come from merging .ctors into .init_array.
Calling 0xffffffff causes the segv.  ffffffff and 00000000 mark the limits
of .ctors as generated by crtstuff.c.

Building binutils with --disable-initfini-array avoids the error.

Not much documentation on this...
Comment 1 H.J. Lu 2011-02-21 18:13:42 UTC
Dup.

*** This bug has been marked as a duplicate of bug 12343 ***
Comment 2 John David Anglin 2011-03-11 02:09:24 UTC
Irrespective of the closing of bug 12343, I still believe this is a binutils bug.  .ctors is incorrectly merged.  binutils should understand the markers
that GCC has used for years.
Comment 3 H.J. Lu 2011-03-17 02:52:38 UTC
(In reply to comment #2)
> Irrespective of the closing of bug 12343, I still believe this is a binutils
> bug.  .ctors is incorrectly merged.  binutils should understand the markers
> that GCC has used for years.

There is no problem with the markers that GCC has used for years.
The problem is the custom markers used by glibc. There is no plan
to support the custom markers used by glibc. If you want to use the
new linker, you need to fix glibc.

*** This bug has been marked as a duplicate of bug 12343 ***