Date: Wed, 26 Nov 2003 09:30:04 -0800 From: Marcel Moolenaar <marcel@xcllnt.net> To: Terry Lambert <tlambert2@mindspring.com> Cc: current@freebsd.org Subject: Re: rtld + static linking Message-ID: <20031126173004.GB10589@dhcp01.pn.xcllnt.net> In-Reply-To: <3FC49986.14E86B70@mindspring.com> References: <Pine.LNX.4.44.0311230707560.13829-100000@a.mx.ict1.everquick.net> <3FC40572.142D4334@mindspring.com> <20031126024927.GA7743@dhcp01.pn.xcllnt.net> <3FC49986.14E86B70@mindspring.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031126173004.GB10589>