This is the mail archive of the
mailing list for the binutils project.
Re: debugging a dynamically loaded library
- To: Kevin Buettner <kevinb at cygnus dot com>,binutils at sourceware dot cygnus dot com,GNU C Library <libc-alpha at sourceware dot cygnus dot com>
- Subject: Re: debugging a dynamically loaded library
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Thu, 6 Sep 2001 10:25:47 -0700
- Cc: Mike Krogh <krogh at ceintl dot com>, gdb at sourceware dot cygnus dot com
- References: <email@example.com> <firstname.lastname@example.org> <1010829224126.ZM19874@ocotillo.lan> <20010829160725.A25904@lucon.org> <email@example.com> <1010903225850.ZM1797@ocotillo.lan> <20010905222950.A21097@lucon.org> <firstname.lastname@example.org> <1010906060403.ZM6589@ocotillo.lan>
On Wed, Sep 05, 2001 at 11:04:03PM -0700, Kevin Buettner wrote:
> On Sep 5, 10:29pm, H . J . Lu wrote:
> > I am wondering if
> > 1327 FUN 0 36 00000000 31372 __strtol_internal:F(0,3)
> > is a valid stab entry. It it is valid, why does it trigger the
> > SOFUN_ADDRESS_MAYBE_MISSING code in gdb. Is that possible a linker
> > or assembler bug?
> It's always possible that there's a bug elsewhere, but my guess is
> that __strtol_internal() is merely the first function in the section
> in which case the above entry makes sense to me.
No. That is not the case. In glibc 2.2, which is used in RedHat 7.1,
__strtol_internal is a weak definition in the object files used to
# objdump --sym eval.os | grep __strtol_internal
00000440 w F .text 00000137 __strtol_internal
But when libdl.so.2 is generated against libc.so.6:
# objdump --sym ../libc.so.6 | grep __strtol_internal
00032d04 g F .text 000006ab __strtol_internal
the linker generates
# objdump --sym libdl.so.2 | grep __strtol_internal
00000000 w F *UND* 000006ab __strtol_internal@@GLIBC_2.0
in libdl.so.2. I am 100% sure where the bug is. It can be in as, ld,
gcc and/or gdb. I tend to think it is a linker bug since the intention
of glibc is to make __strtol_internal weak defined, not weak undefined.
My second thought a weak undefined __strtol_internal in this case may
be the right thing to do, given how weak should be treated. Now the
question is how as/ld/gcc/gdb should deal a symbol which is turned from
weak defined to weak undefined. Does stabs/gdb support the notation of
weak defined symbol, which may be changed between compile-time,
link-time and run-time?
As for how useful a weak defined __strtol_internal is in libdl.so, that
is an entirely different question.