This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Static binary, .so plugins that are static too - can it be done
On Sun, Jul 29, 2001 at 06:08:02PM +0930, Alan Modra wrote:
> On Sat, Jul 28, 2001 at 06:45:44PM +0200, bert hubert wrote:
> > 1) does a 'static shared library' even exist?
> > It might be possible to have such a library link in
> > everything statically?
>
> You could arrange for your modules to load at fixed addresses. Use
> jump tables to call functions and tables of pointers to access variables.
> Messy but workable. Linux aout shared libs used this scheme.
>
> > 2) If I reduce the .so's dependencies to just ld-linux.so, which
> > would then come from an older glibc, would that work? The .so
> > would then not link in libc and libm, but 'get' the functions
> > from the static binary?
>
> Yes, you could link your modules against static libc.
Just for the record, dlopen in a static binary is not supported in most
of OSes using the ELF format. The GNU C library has limited support for
it, which is mainly for NSS. That means if it doesn't work for you now,
it probably never will.
BTW, I don't know why someone wants to dlopen in a static binary. It is
a very bad idea to begin with.
H.J.