[unix-pc.general] shared lib ...

richard@islenet.UUCP (Richard Foulk) (07/28/88)

There have been several different scripts posted lately that
automate the process or compiling and linking programs with
the shared library.  The more recent ones extract some routines
that weren't defined in the shared lib and link them separately
to keep the resultant binaries as small as possible.

My question is; why not find the missing routines within the
shared library and add the to your shlib.ifile?  Since most
of the missing routines are called from other routines that
are listed in shlib.ifile then they must be in there.  (_doprnt,
for instance is at tbase+0x18a34.)

I know that the supported routines are all vectored through a
jump table at the beginning of the library that helps keep things
neat and portable.  But is that really an issue?  It's not like
we're going to have to worry about upgrading to a newer version
of Unix or anything.

What are the other concerns?  Or are the gains too small to
worry about?

Actually, I'd like to hang the curses library on the end of
the shared library -- it's so enormous it would save all kinds
of disk space, and loading time.  (Curses is about 10 times
as large as a few versions ago.)


Richard Foulk		...{vortex,ihnp4,spl1}!islenet!richard
Honolulu, Hawaii
-- 
Richard Foulk		...{vortex,ihnp4,spl1}!islenet!richard
Honolulu, Hawaii

gene@zeno.MN.ORG (Gene H. Olson) (07/31/88)

In article <4121@islenet.UUCP> you write:
>There have been several different scripts posted lately that
>automate the process or compiling and linking programs with
>the shared library.  The more recent ones extract some routines
>that weren't defined in the shared lib and link them separately
>to keep the resultant binaries as small as possible.
>
>My question is; why not find the missing routines within the
>shared library and add the to your shlib.ifile?  Since most
>of the missing routines are called from other routines that
>are listed in shlib.ifile then they must be in there.  (_doprnt,
>for instance is at tbase+0x18a34.)

I remember from reading the doco on 5.3 shared libraries, that
careful hacking of the source code was required to make up for
inherent deficiencies in the shared library implementation.

Reference "The UNIX System 5 Programmers Manual" Section 8,
"Shared Libraries", Pages 8-30 -> 8-32 "Changing Existing Code
for the Shared Libraries".

The 3B1 implementation appears to be different from the 5.3
implementation, probably it was a first hack that served as a
prototype for the 5.3 stuff.   At any rate it is probably more
difficult to achieve a reasonable shared library on the 3B1.

In the absence of source code for the libraries, it may be difficult
or impossible to add to the shared libraries.

Perhaps someone on the net can elaborate on the Convergent 3B1
implementation.

Gene H. Olson
gene@zeno.mn.org

richard@islenet.UUCP (Richard Foulk) (08/01/88)

I had several replys to my inquiry about the "missing" entries
in the shared library.  I was unable to reply by mail.

The only routine that I've taken the time to locate thus far is
_doprnt.  Apparently the address I gave doesn't work for everyone.
I'm pretty sure it won't work for 3.0 and it may not work for 3.5
either.  All I know is that it does work for 3.51.  The address is
0x328a34 (_tbase + 0x18a34).

Here's a test of the shared lib _doprnt:

# to unbundle, "sh" this file -- DO NOT use csh
#  SHAR archive format.  Archive created Sun Jul 31 06:27:00 PM
echo x - Makefile
sed 's/^X//' > Makefile <<'+FUNKY+STUFF+'
XCC=/bin/cc
X
Xt:	t.o ifile-add
X	ld /lib/crt0s.o /lib/shlib.ifile ifile-add t.o -o t
+FUNKY+STUFF+
echo '-rw-r--r--  1 richard users        82 Jul 31 18:21 Makefile    (as sent)'
chmod u=rw,g=r,o=r Makefile
ls -l Makefile
echo x - t.c
sed 's/^X//' > t.c <<'+FUNKY+STUFF+'
X#include <stdio.h>
X
Xmain() {
X	char *format = "%s %s %s %s\n";
X	static char *cv[] = { "this", "is", "a", "test" };
X
X	_doprnt(format, cv, stdout);
X}
+FUNKY+STUFF+
echo '-rw-r--r--  1 richard users       147 Jul 31 18:14 t.c    (as sent)'
chmod u=rw,g=r,o=r t.c
ls -l t.c
echo x - ifile-add
sed 's/^X//' > ifile-add <<'+FUNKY+STUFF+'
X_doprnt = 0x328a34;
+FUNKY+STUFF+
echo '-rw-r--r--  2 richard users        20 Jul 31 18:24 ifile-add    (as sent)'
chmod u=rw,g=r,o=r ifile-add
ls -l ifile-add
exit 0
-- 
Richard Foulk		...{vortex,ihnp4,spl1}!islenet!richard
Honolulu, Hawaii