Date: Thu, 31 Oct 2002 13:49:24 -0800 From: Terry Lambert <tlambert2@mindspring.com> To: Alexander Kabaev <ak03@gte.com> Cc: Daniel Eischen <eischen@pcnet1.pcnet.com>, dfr@nlsystems.com, current@freebsd.org Subject: Re: [PATCH: libc]Re: gnome on current Message-ID: <3DC1A564.F354DD63@mindspring.com> References: <20021031161630.Q69202-100000@herring.nlsystems.com> <Pine.GSO.4.10.10210311211200.20637-100000@pcnet1.pcnet.com> <20021031132345.0c6901a3.ak03@gte.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Kabaev wrote: > By default, ti_jump_table entries contain pointers to dummy function like > _return_zero if no threading library is loaded. When the threading library is > loaded, ti_jump_table is populated with new pointers to functions implemented > in threading library library. GDB did not allow me to track down where exactly > this happens, I presume .init function in libpthread.so does that. Using .init for this isn't strictly possible. Only one .init is invoked by the crt0, so if you replace it, you displace the code that would normally call the static constructors. You can't use a static constructor, because you don't get the environment block as a parameter to each constructor in the linker set traversed by the default .init. I ran into this same problem when creating a libdlopen; the other issue in the area is that even if you fix the parameter to be void * instead of void (with a "coincidental" value of the value of the address of the environment block), you don't necessarily get the correct order. The only way you can really deal with this is to either have a secondary linker set, or to have a priority parameter, and convert the thing to structure pointers instead of function pointers, and then bubble sort on priority (kind of like what I did in the SYSINIT() code). The same thing goes for a library that creates its own worker thread, and then serializes requests in a queue to wrap a non-reentrant library with a thread-safe wrapper (e.g. the Netscape LDAP client library). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DC1A564.F354DD63>