From owner-freebsd-current@FreeBSD.ORG Wed Nov 26 09:30:14 2003 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 E77F616A4CE for ; Wed, 26 Nov 2003 09:30:14 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id D360E43FA3 for ; Wed, 26 Nov 2003 09:30:12 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id hAQHUCEG043945; Wed, 26 Nov 2003 09:30:12 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) hAQHUCWx010697; Wed, 26 Nov 2003 09:30:12 -0800 (PST) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.10/8.12.10/Submit) id hAQHU4A3010696; Wed, 26 Nov 2003 09:30:04 -0800 (PST) (envelope-from marcel) Date: Wed, 26 Nov 2003 09:30:04 -0800 From: Marcel Moolenaar To: Terry Lambert Message-ID: <20031126173004.GB10589@dhcp01.pn.xcllnt.net> References: <3FC40572.142D4334@mindspring.com> <20031126024927.GA7743@dhcp01.pn.xcllnt.net> <3FC49986.14E86B70@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3FC49986.14E86B70@mindspring.com> User-Agent: Mutt/1.5.4i cc: "E.B. Dreger" cc: current@freebsd.org Subject: Re: rtld + static linking 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: Wed, 26 Nov 2003 17:30:15 -0000 On Wed, Nov 26, 2003 at 04:16:06AM -0800, Terry Lambert wrote: > > > > Dynamic linking works because the kernel loads and runs the dynamic > > linker when it sees that the executable defines an interpeter. > > Since I have patches to make dlopen work with static binaries, and > it doesn't work this way, I must conclude you have not really looked > deeply into solving the problem. True. I did not look at aout. > In any case, I point you to /usr/src/lib/csu/i386/crt0.c, which > contains these lines of code: This is aout specific code, not ELF code. > Ether way, you still need to deal with the linker changes necessary > to export the symbol set for all statically linked objects, and to > force the inclusion of all archive members when statically linking, > if one of the linked libraries is libdl, if you wanted a full > implementation. I think the cure is worse than the decease in this case. You don't want the full libc linked into a static sh, simply because we need to be able to load a shared library at runtime. If you can get gcc and binutils to add the necessary support, then we can talk further. Until then it's academic. > BTW: IEEE 1003.1-2003 requires a full implementation of dlopen, and > does not permit an exception for statically linked binaries: > > http://www.opengroup.org/onlinepubs/007904975/functions/dlopen.html Yes it does: \begin{quote} ... Implementations may also impose specific constraints on the construction of programs that can employ dlopen() and its related services. \end{quote} > I'll also point out that the ELF specification does not define static > linking *at all*. I think that's because it doesn't need any special mention. Note that staticly linked executables can be in violation of platform runtime specifications. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net