bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overloaded shared-library functions on hppa-linux


From: John David Anglin
Subject: Re: Overloaded shared-library functions on hppa-linux
Date: Sat, 20 Apr 2002 17:37:20 -0400 (EDT)

Alan,

> On Fri, Apr 19, 2002 at 10:55:23PM -0400, John David Anglin wrote:
> > I rebuilt and installed just the linker.  A test with relinking libstdc++
> > shows that we still don't get stubs for calls within the shared library.
> > I then tried rebuilding binutils and got the following error:
> 
> Another try.  Added last hunk of this diff.
> 
>       * elf32-hppa.c (hppa_type_of_stub): Correct and simplify condition
>       under which a plt call stub is used.
>       (final_link_relocate): Similarly.
>       (allocate_plt_static): Clear h-plabel except when plt entry is
>       exclusively used for a plabel.
>       (allocate_dynrelocs): Use the above to simplify plt sizing.

This is looking much more promising.  There are now stubs in libstdc++.so
for the pc relative calls and the new3 test now passes.  However, there
was one regression in the v3 testsuite (new related) and in trying to
rebuild gcc the following error occurs:

address@hidden:~/gcc-3.2/objdir/gcc/fixinc$ ./fixincl -v < /dev/null
'fixincl version 1.1'
Segmentation fault

The seg fault is in atexit 0x222a4:

0x22290 <atexit>:       stw rp,-14(sr0,sp)
0x22294 <atexit+4>:     stw,ma r3,40(sr0,sp)
0x22298 <atexit+8>:     stw r19,-20(sr0,sp)
0x2229c <atexit+12>:    addil 2000,r19,%r1
0x222a0 <atexit+16>:    copy r19,r3
0x222a4 <atexit+20>:    ldw 694(sr0,r1),r1
0x222a8 <atexit+24>:    cmpib,= 0,r1,0x222b4 <atexit+36>
0x222ac <atexit+28>:    ldi 0,r24
0x222b0 <atexit+32>:    ldw 0(sr0,r1),r24
0x222b4 <atexit+36>:    b,l 0x111a8 <_end_init+260>,rp
0x222b8 <atexit+40>:    ldi 0,r25
0x222bc <atexit+44>:    ldw -54(sr0,sp),rp
0x222c0 <atexit+48>:    copy r3,r19
0x222c4 <atexit+52>:    bv r0(rp)
0x222c8 <atexit+56>:    ldw,mb -40(sr0,sp),r3

It can be seen that exit has been compiled as pic code.  The call to atexit
goes by a simple stub:

0x1565c <server_setup+64>:      b,l 0x22290 <atexit>,rp
0x15660 <server_setup+68>:      nop

So, r19 is not set correctly.  It appears this version of atexit
has been loaded from libc_nonshared.a:

address@hidden:~/gcc-3.2/objdir/gcc/fixinc$ gcc -DIN_GCC -DHAVE_CONFIG_H 
-DIN_GCC -g -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wtraditional -pedantic -Wno-long-long -DHAVE_CONFIG_H -DGENERATOR_FILE  -W 
-Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional 
-pedantic -Wno-long-long -I. -I.. -I../../../gcc/gcc/fixinc 
-I../../../gcc/gcc/fixinc/.. -I../../../gcc/gcc/fixinc/../config 
-I../../../gcc/gcc/fixinc/../../include  -o fixincl fixincl.o fixtests.o 
fixfixes.o server.o procopen.o gnu-regex.o fixlib.o ../../libiberty/libiberty.a 
-Wl,-v -Wl,--trace-symbol=atexit 
collect2 version 3.2 20020418 (experimental) (hppa)
/home/dave/opt/gnu/bin/ld --eh-frame-hdr -dynamic-linker /lib/ld.so.1 -o 
fixincl /home/dave/opt/gnu/lib/crt1.o /home/dave/opt/gnu/lib/crti.o 
/home/dave/opt/gnu/lib/gcc-lib/hppa-linux/3.2/crtbegin.o 
-L/home/dave/opt/gnu/lib -L/home/dave/opt/gnu/lib/gcc-lib/hppa-linux/3.2 
-L/home/dave/opt/gnu/lib/gcc-lib/hppa-linux/3.2/../../../../hppa-linux/lib 
-L/home/dave/opt/gnu/lib/gcc-lib/hppa-linux/3.2/../../.. fixincl.o fixtests.o 
fixfixes.o server.o procopen.o gnu-regex.o fixlib.o ../../libiberty/libiberty.a 
-v --trace-symbol=atexit -lgcc -lgcc_eh -lc -lgcc -lgcc_eh 
/home/dave/opt/gnu/lib/gcc-lib/hppa-linux/3.2/crtend.o 
/home/dave/opt/gnu/lib/crtn.o
server.o: reference to atexit
/home/dave/opt/gnu/lib/libc_nonshared.a(atexit.oS): definition of atexit
GNU ld version 2.12.90 20020411

It would appear ld does special things with "-lc".  Do we need "pic" stubs
for libc_nonshared.a or has it been built incorrectly?  I see we have
address@hidden in the shared library.

Dave
-- 
J. David Anglin                                  address@hidden
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]