Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Feb 2002 14:53:11 -0500 (EST)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        jdp@freebsd.org, obrien@freebsd.org
Cc:        freebsd-alpha@freebsd.org
Subject:   gdb, binutils & rtld on alpha -current
Message-ID:  <15473.23463.76106.50785@grasshopper.cs.duke.edu>

next in thread | raw e-mail | index | archive | help

After finally being able to install a new world on alpha, I realized
that gdb seems to be broken.  It goes into an infinate loop when
starting up. 

If I run it under an older, working gdb from -stable and ^C it 
on startup, its stuck here:

(gdb) where
#0  0x1601ade14 in _rtld_bind () from /usr/libexec/ld-elf.so.1
#1  0x1601ad53c in _rtld_bind_start () from /usr/libexec/ld-elf.so.1
#2  0x1200c4c60 in set_width ()
    at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb.291/gdb/utils.c:1427
#3  0x1200c4cb4 in set_width_command (args=0x1201e8200 "", from_tty=82, 
    c=0x1201ec400)
    at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb.291/gdb/utils.c:1438
#4  0x1200c6850 in initialize_utils ()
    at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb.291/gdb/utils.c:2372
#5  0x1200b69f0 in gdb_init (
    argv0=0x11fff968 "/usr/src/gnu/usr.bin/binutils/gdb/gdb")
    at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb.291/gdb/top.c:663
#6  0x120075f50 in main (argc=301989179, argv=0x11fffd6f)
    at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb.291/gdb/main.c:403

It seems to be looping somewhere in rtld.  Interestingly enough, the
line number that its stuck on is:

  1427      wrap_buffer = (char *) xrealloc (wrap_buffer, chars_per_line + 2);


xrealloc is multiply defined -- once in the system libc, and once in
libiberty, which is statically linked into the binary.

% nm gdb | grep xreall
00000001200c4060 T USE_FROM_LIBIBERTY_NOW_xrealloc
00000001201aad50 ? xrealloc

And static linking  fails:
../libiberty/libiberty.a(xmalloc.o): In function `xmalloc':
/usr/src/gnu/usr.bin/binutils/libiberty/../../../../contrib/binutils/libiberty/xmalloc.c:133: multiple definition of `xmalloc'
/usr/lib/libreadline.a(xmalloc.o)(.text+0x60): first defined here
/usr/libexec/elf/ld: Warning: size of symbol `xmalloc' changed from 72 to 80 in ../libiberty/libiberty.a(xmalloc.o)
../libiberty/libiberty.a(xmalloc.o): In function `xrealloc':
/usr/src/gnu/usr.bin/binutils/libiberty/../../../../contrib/binutils/libiberty/xmalloc.c:164: multiple definition of `xrealloc'
/usr/lib/libreadline.a(xmalloc.o)(.text+0xc0): first defined here
/usr/libexec/elf/ld: Warning: size of symbol `xrealloc' changed from 104 to 112 in ../libiberty/libiberty.a(xmalloc.o)


If I remove the offending xmalloc and xrealloc functions from libiberty,
then static linking succeeds and a normal, shared binary also works fine.

I suspect there are 2 problems here.. The multiple definition, and the
infinate loop of rtld in the face of a multiply defined symbol.

Thanks for the help,

Drew


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15473.23463.76106.50785>