From owner-freebsd-current Thu Oct 31 13:52:14 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 70D3F37B40D for ; Thu, 31 Oct 2002 13:52:12 -0800 (PST) Received: from harrier.mail.pas.earthlink.net (harrier.mail.pas.earthlink.net [207.217.120.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2227443E4A for ; Thu, 31 Oct 2002 13:52:12 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from pool0205.cvx22-bradley.dialup.earthlink.net ([209.179.198.205] helo=mindspring.com) by harrier.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 187NES-0000Pq-00; Thu, 31 Oct 2002 13:52:05 -0800 Message-ID: <3DC1A564.F354DD63@mindspring.com> Date: Thu, 31 Oct 2002 13:49:24 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Alexander Kabaev Cc: Daniel Eischen , dfr@nlsystems.com, current@freebsd.org Subject: Re: [PATCH: libc]Re: gnome on current References: <20021031161630.Q69202-100000@herring.nlsystems.com> <20021031132345.0c6901a3.ak03@gte.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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