From owner-freebsd-current@FreeBSD.ORG Sat Feb 14 19:11:28 2004 Return-Path: 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 47A4816A4CE for ; Sat, 14 Feb 2004 19:11:28 -0800 (PST) Received: from mgate11.so-net.ne.jp (mgate11.so-net.ne.jp [210.139.254.158]) by mx1.FreeBSD.org (Postfix) with ESMTP id D200043D1D for ; Sat, 14 Feb 2004 19:11:27 -0800 (PST) (envelope-from fuyuki@nigredo.org) Received: from mail.dg8.so-net.ne.jp (mspool12.so-net.ne.jp [210.139.248.12]) by mgate11.so-net.ne.jp with ESMTP id i1F37iP08772; Sun, 15 Feb 2004 12:07:45 +0900 (JST) Received: from ns.nigredo.org (p6242d5.spprac00.ap.so-net.ne.jp [219.98.66.213]) by mail.dg8.so-net.ne.jp with ESMTP id i1F37iE00174; Sun, 15 Feb 2004 12:07:44 +0900 (JST) Received: from ns.nigredo.org (localhost [IPv6:::1]) by ns.nigredo.org (Postfix) with ESMTP id 2947020A4; Sun, 15 Feb 2004 12:07:44 +0900 (JST) Date: Sun, 15 Feb 2004 12:07:44 +0900 Message-ID: <86ptchkpkv.wl%fuyuki@nigredo.org> From: Kimura Fuyuki To: mbsd@pacbell.net In-Reply-To: <20040214172047.K96655@sotec.home> References: <86n07oa7sa.wl%fuyuki@nigredo.org> <20040214172047.K96655@sotec.home> User-Agent: Wanderlust/2.10.1 (Watching The Wheels) Emacs/21.3 Mule/5.0 (SAKAKI) X-Public-Key: http://www.nigredo.org/fuyuki/public.key X-Fingerprint: 8D68 1138 1A85 8556 C6A9 274B 2C72 2E56 3AF7 3D89 MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable cc: freebsd-current@freebsd.org Subject: Re: relocator oddity? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Feb 2004 03:11:28 -0000 At Sat, 14 Feb 2004 17:48:25 -0800 (PST), Mikko Ty=F6l=E4j=E4rvi wrote: >=20 > # Try this: > cc -shared -o shared.so shared.c -Wl,-Bsymbolic > If you want to ensure that global symbol refereces inside a shared > object are bound to symbols inside the object itself, you'll have to > tell the linker to do so, otherwise it will resolve the symbols at run > time, possibly from somewhere else. >=20 > Another way is to make your internal "sin()" implementation static. Yes, it actually works for the situation, but the shared libraries may be supplied as binary packages so that "-symbolic" and "static" is not a generic solution. > This is how one can do lots of funny things with LD_PRELOAD :) I'm also doubtful whether it is the right thing that LD_PRELOAD can break the shared objects' integrity... > I don't know if there is a complete specification for the dynamic > linker search order somewhere, or if it is "implentation defined". I > do know that there are subtle differences between systems, though. I'm very frustrated in the current search order since it does not work well on the situation such like: 1. mylib.so is linked against libmyc.so. 2. libmyc.so provides printf(). (it of course lives in libc too.) 3. foo() in mylib.so calls printf() and it is intended to reach libmyc.so. 4. I want to dlopen mylib.so and use foo()! -- fuyuki