Subject: Re: How to make a shared lib from static one
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 09/15/1995 06:40:28
> I'm trying to make an libc.so.12.3 or equivalent shared libc by
> modifying the "normal" version.  This modification involves adding my
> own functions write(), read(), sbrk() etc., and renaming the old
> versions of write() read() sbrk() to write_VMT() read_VMT()
> sbrk_VMT() etc.

As someone else remarked, this will probably be easiest by going to the
source, rather than trying to hack on binaries.  But that aside,

[...]
> 2) use this program I inherited, binwrap, to modify the symbol "write"
>    to "write_VMT" in write.so, and repeat for read, sbrk, etc.
[...]
> But this fails on step 2.  Binwrap, you see, uses bfdutils from GNU,
> which gives:
> binwrap writev.so writev_VMT.so _writev _writev_VMT
> bfd assertion fail aoutx.h:2189

I have a symbol-table patcher for SunOS, which (since the a.out format
is very similar) should need minimal work for NetBSD.  (I have two of
them, actually, one which renames symbols and one which changes them
from global to local - ie, removes the N_EXT bit.)

> ld -Bdynamic -o libc.so.12.3 *
> (This worked in SunOS).

The NetBSD ld is _not_ command-line compatible with the SunOS one, nor
(I believe) is it supposed to be.

Look at the Makefiles (specifically, I think, /usr/share/mk/bsd.lib.mk)
to see how they create shared libraries.  Then try again....

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu