This is the mail archive of the libc-alpha@sourceware.org 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]
Other format: [Raw text]

Re: __gmon_start__ symbol vs. dependencies between shared libraries


Hello!

On 2009-12-02 00:05, Kaz Kojima wrote:
> Daniel Jacobowitz <drow@false.org> wrote:
>> On Tue, Dec 01, 2009 at 10:31:07AM +0100, Thomas Schwinge wrote:
>>> That is, __gmon_start__ is required for order2mod3.so, and is bound to
>>> order2mod1.so's (weak) definition.  Correct would be that order2mod3.so
>>> falls back to its *own* (weak) definition of it, unless the real
>>> definition of this symbol is linked in through gcrt1.o.
>>> 
>>> The following tiny patch fixes this, and makes the following tests pass,
>>> which failed previously: elf/reldep3.out, elf/neededtest.out,
>>> elf/order2.out.
>> 
>> I'm not sure this patch has the effect you wanted.  If you have a
>> weak, hidden definition, will the linker ever call a strong version
>> if it's in a different DSO?  I don't think so; .hidden will suppress a
>> dynamic relocation against the __gmon_start__ name.

It's not in a different DSO: gcrt1.o contains the real definition of
__gmon_start__, and is being liked into every DSO (when using -pg).
Nevertheless:

>> SH seems to be the only architecture with a weak definition of
>> __gmon_start__.  And it isn't doing anything, that I can see.
>> Should it be replaced with a conditional function call?
>
> I think so too.

I agree that this is the better fix.

> The generic/initfini.c trick didn't work for SH
> because of the constant pools and sh/elf/initfini.c was made by
> hand with modifying the assembler output for generic/initfini.c
> so that those constant pools are placed appropriately.  I've
> attached an updated initfini.c with redoing that process which
> is almost mechanical.  Thomas, does it work for you?

Sort of.  It does fix the elf/neededtest.out, elf/order2.out,
elf/reldep3.out tests, but it makes elf/check-textrel.out fail:

    $ grep -v OK$ elf/check-textrel.out
    [...]/crypt/libcrypt.so: text relocations used
    [...]/debug/libSegFault.so: text relocations used
    [...]/debug/libpcprofile.so: text relocations used
    [...]/dlfcn/libdl.so: text relocations used
    [...]/hesiod/libnss_hesiod.so: text relocations used
    [...]/libidn/libcidn.so: text relocations used
    [...]/locale/libBrokenLocale.so: text relocations used
    [...]/login/libutil.so: text relocations used
    [...]/malloc/libmemusage.so: text relocations used
    [...]/math/libm.so: text relocations used
    [...]/nis/libnsl.so: text relocations used
    [...]/nis/libnss_compat.so: text relocations used
    [...]/nis/libnss_nis.so: text relocations used
    [...]/nis/libnss_nisplus.so: text relocations used
    [...]/nptl_db/libthread_db.so: text relocations used
    [...]/nss/libnss_files.so: text relocations used
    [...]/resolv/libanl.so: text relocations used
    [...]/resolv/libnss_dns.so: text relocations used
    [...]/resolv/libresolv.so: text relocations used
    [...]/rt/librt.so: text relocations used


Regards,
 Thomas

Attachment: pgp00000.pgp
Description: PGP signature


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