This shar file contains the ingrediants for a different style
of dynamic loading for S.  It uses the unix 'ld' command with
the '-A' flag to link your function to S's symbol table, then
reads in the relevant stuff from the output of 'ld'.  This is
pretty easy to adapt to new machines -- you just have to fig-
ure out the format of the symbol table and code sections, you
do not have to understand the relocation scheme.  It also takes
care of finding things in libraries because 'ld' does that.

It is a bit slower than the present scheme of having S do the
relocation.  'ld' will only know about the symbol table compiled
into S, not about those added by previous dyn.load2() calls,
so you must add related functions in one call.

The ATT 3B2 'ld' does not seem to have an option for incremental
linking.  Is that correct?  Does anyone know about other
system V ld's?

If you install dyn.load2, you can still use the old dyn.load
with no changes.

I have ifdef'ed the code for the following machines
	Vax (BSD)
	Sun3
	Sun4
	IBM RT (BSD style OS)
	Sun386i (this uses COFF)
	HP 9000/350 (this uses sort of BSD style a.out)
	HP 9000/835 (this uses COFF)
	Iris 4D (also COFF a.out, a MIPS processor)
The ifdef's depend on symbols predefined by the C preprocessor
on each machine, not on what might happen to be in the
system.h file.

I have tested the method as a small standalone program on each of these
machines, but have tested this as part of S only on the Sun3,
HP9000/835, HP9000/350, and Iris 4D.  It passes lint on the Sun386i.
I'm busy with other things now and several of our machines are down or
short on disk space so I haven't been able to test it on all the
machines that I would like.

I noticed some interest in dynamic loading on new machines
so I'm sending this out now in the hopes it may be usefull.

INSTALLATION :
Here are some installation hints :

All Machines : Add dyn_load.o to list of MAIN functions in $QPE/Makefile.
Use 'patch' to apply the patch file (this alters only sys_funs.c).
Copy dyn_load.c to $QPE.

SunOS 4.0 : ld nnSqpe with the -Bstatic flag.  This does not
appreciably increase the size of the executable and it
decreases the size and number of new symbols in the output of 'ld -A'.
Thus, in $QPE/Makefile set 'LDFLAGS=-Bstatic'

Sun 386i : You must use the library '-lld' when making nnSqpe.

Iris 4D : You must use the library '-lmld' when making nnSqpe.
You must also use the flags 
	CFLAGS=... -G 0 ...
	LDFLAGS=-G 0  -Wl,'-T 10000000' -Wl,'-D 12000000'.
(I actually used 'ld' directly to avoid the -Wl business.)
The '-T number' means start the text segments here, '-D' is for
the data segments.  By default the text starts at 0 and the data
at 0x10000000.  The new functions will be placed in data space
(malloc'ed space) and the linker refuses to allow jumps that
big.  Thus I push the text and data segments closer together.
Make sure there is enough room in the text segment for S.
0x4000000 bytes should be plenty for the forseeable future.
You must compile your dynamically loaded code with CFLAGS=-G 0.

HP 9000/835 : This uses COFF and has a '-lld' library, but not then
include files needed to use it, so I wrote a simplified version
of that library.  This may not be needed in the future.

New Machines : Most new machines will use COFF style executables,
so look at the code ifdef'ed for Sun386i, etc.  I added a bunch
of macros to take of common machine differences; I hope the names
are self explanatory.

(Note from Bill Dunlap)
I just tested the new dyn.load code on the IBM RT running ACIS 4.3
(~= BSD 4.3) and a Sun 386i running SunOS 4.0 and it worked.  To
make it work on a DecStation 3100 (a.k.a pmips -- it has the MIPS
processor), use same #ifdef branches as for the IRIS 4D and add
the #define
	#define FREAD FREADM

