This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

Re: Versioning mess proved!!!


On Mon, 02 Oct 2000, Geoff Keating wrote:
> > From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
> > Date: Mon, 2 Oct 2000 00:05:12 +0200
> >
> > the zlib.so compiled against glibc-2.1.3:
> > [fsirl@enzo:/cvsx/rawhide/zlib-1.1.3]$ objdump -R /usr/lib/libz.so|grep
> > gmon 0001debc R_PPC_JMP_SLOT    __gmon_start__
> >
> > the zlib.so compiled against glibc-2.1.94:
> > [fsirl@enzo:/cvsx/rawhide/zlib-1.1.3]$ objdump -R
> > ../BUILD/zlib-1.1.3/libz.so|grep gmon
> > 0001e994 R_PPC_GLOB_DAT    __gmon_start__
> >
> > the zlib example compiled against glibc-2.1.94 and
> > zlib.so-compiled-against-2.1.3:
> > [fsirl@enzo:/cvsx/rawhide/zlib-1.1.3]$ objdump -R example|grep gmon
> > 10012ee8 R_PPC_GLOB_DAT    __gmon_start__
> > 10013104 R_PPC_JMP_SLOT    __gmon_start__
> >
> > And I guess this double relocation is the culprit then?
>
> Nope.  The other two should have two relocations too.
>
> I expect the code that calls __gmon_start__ looks like:
>
> 	lwz r3,__gmon_start__@got(r31)
> 	cmpwi r3,0
> 	beq L1234
> 	bl  __gmon_start__@plt
> L1234:
>
> you should get a R_PPC_GLOB_DAT for the `lwz', and the `bl' should be
> relocated to branch to a PLT entry which has a R_PPC_JMP_SLOT
> relocation.  (I'm not sure that this should happen in executables, but
> there's no particular reason why not.)

nearly, except glibc branches via a blrl, maybe a gdb session does illustrate 
it better:

[fsirl@enzo:/cvsx/rawhide/zlib-1.1.3-1]$ LD_LIBRARY_PATH=../BUILD/zlib-1.1.3/ 
LD_BIND_NOW=1 gdb ./example
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "ppc-redhat-linux"...
(gdb) b call_gmon_start
Breakpoint 1 at 0x10000a84
(gdb) r
Starting program: /cvsx/rawhide/zlib-1.1.3-1/./example
Breakpoint 1 at 0xffd2c68

Breakpoint 1, 0xffd2c68 in call_gmon_start () from 
/cvsx/rawhide/zlib-1.1.3-1/../BUILD/zlib-1.1.3/libz.so.1
(gdb) disass
Dump of assembler code for function call_gmon_start:
0xffd2c54 <call_gmon_start>:    stwu    r1,-16(r1)
0xffd2c58 <call_gmon_start+4>:  mflr    r0
0xffd2c5c <call_gmon_start+8>:  stw     r30,8(r1)
0xffd2c60 <call_gmon_start+12>: stw     r31,12(r1)
0xffd2c64 <call_gmon_start+16>: stw     r0,20(r1)
0xffd2c68 <call_gmon_start+20>: bl      0xffef988 <__DTOR_END__+4>
0xffd2c6c <call_gmon_start+24>: mflr    r30
0xffd2c70 <call_gmon_start+28>: lwz     r0,8(r30)
0xffd2c74 <call_gmon_start+32>: cmpwi   r0,0
0xffd2c78 <call_gmon_start+36>: beq     0xffd2c84 <call_gmon_start+48>
0xffd2c7c <call_gmon_start+40>: mtlr    r0
0xffd2c80 <call_gmon_start+44>: blrl
0xffd2c84 <call_gmon_start+48>: lwz     r0,20(r1)
0xffd2c88 <call_gmon_start+52>: mtlr    r0
0xffd2c8c <call_gmon_start+56>: lwz     r30,8(r1)
0xffd2c90 <call_gmon_start+60>: lwz     r31,12(r1)
0xffd2c94 <call_gmon_start+64>: addi    r1,r1,16
0xffd2c98 <call_gmon_start+68>: blr
0xffd2c9c <call_gmon_start+72>: .long 0x24b90
End of assembler dump.
(gdb) x /20 __DTOR_END__
(gdb) x /20 0xffef988
0xffef988 <__DTOR_END__+4>:     0x4e800021      0x0001e99c      0x00000000    
  0x10012d68
0xffef998 <__DTOR_END__+20>:    0x00000000      0x00000001      0x00000485    
  0x0000000e
0xffef9a8 <__DTOR_END__+36>:    0x000004a7      0x0000000c      0x00001c2c    
  0x0000000d
0xffef9b8 <__DTOR_END__+52>:    0x0000c14c      0x00000004      0x00000094    
  0x00000005
0xffef9c8 <__DTOR_END__+68>:    0x0ffd1ce4      0x00000006      0x0ffd14b4    
  0x0000000a
(gdb) disass __gmon_start__
(0x10012d68 <__gmon_start__>:    ba      0x0
0x10012d6c <__gmon_start__+4>:  .long 0x0
0x10012d70 <__gmon_start__+8>:  .long 0x0
0x10012d74 <__gmon_start__+12>: .long 0x0
0x10012d78 <__gmon_start__+16>: .long 0x0
0x10012d7c <__gmon_start__+20>: .long 0x0
0x10012d80 <__gmon_start__+24>: .long 0x0
0x10012d84 <__gmon_start__+28>: .long 0x0
0x10012d88 <__gmon_start__+32>: .long 0x0
0x10012d8c <__gmon_start__+36>: .long 0x0
0x10012d90 <__gmon_start__+40>: .long 0x0
0x10012d94 <__gmon_start__+44>: .long 0x0
0x10012d98 <__gmon_start__+48>: .long 0x0
0x10012d9c <__gmon_start__+52>: .long 0x0
0x10012da0 <__gmon_start__+56>: .long 0x0
0x10012da4 <__gmon_start__+60>: .long 0x0
0x10012da8 <__gmon_start__+64>: .long 0x0
0x10012dac <__gmon_start__+68>: .long 0x0
0x10012db0 <__gmon_start__+72>: .long 0x0
0x10012db4 <__gmon_start__+76>: .long 0x0
0x10012db8 <__gmon_start__+80>: .long 0x0
0x10012dbc <__gmon_start__+84>: .long 0x0
0x10012dc0 <__gmon_start__+88>: .long 0x0
0x10012dc4 <__gmon_start__+92>: .long 0x0
0x10012dc8 <__gmon_start__+96>: .long 0x0
0x10012dcc <__gmon_start__+100>:        .long 0x0
0x10012dd0 <__gmon_start__+104>:        .long 0x0
0x10012dd4 <__gmon_start__+108>:        .long 0x0
0x10012dd8 <__gmon_start__+112>:        .long 0x0
0x10012ddc <__gmon_start__+116>:        .long 0x0
0x10012de0 <__gmon_start__+120>:        .long 0x0
0x10012de4 <__gmon_start__+124>:        .long 0x0
0x10012de8 <__gmon_start__+128>:        .long 0x0
0x10012dec <__gmon_start__+132>:        .long 0x0
0x10012df0 <__gmon_start__+136>:        .long 0x0
0x10012df4 <__gmon_start__+140>:        .long 0x0
0x10012df8 <__gmon_start__+144>:        .long 0x0
0x10012dfc <__gmon_start__+148>:        .long 0x0
End of assembler dump.
(gdb) c
Continuing.
 
Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb) bt
#0  0x0 in ?? ()
#1  0xffd2c84 in call_gmon_start () from 
/cvsx/rawhide/zlib-1.1.3-1/../BUILD/zlib-1.1.3/libz.so.1
#2  0xffd2c3c in _init () from 
/cvsx/rawhide/zlib-1.1.3-1/../BUILD/zlib-1.1.3/libz.so.1
#3  0x3000dfe0 in _dl_init (main_map=0x30027648, argc=1, argv=0x7ffffc04, 
env=0x7ffffc0c) at dl-init.c:111
#4  0x30012664 in _dl_start_user () from /lib/ld.so.1
(gdb)

Franz.

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