From: jkh
Subject: faslink/fasload in AKCL/KCL
Date:
Message-ID: <944@pcsbst.UUCP>
I think I've finally figured this out and thought I'd explain it for the
benefit of those who said "When you figure it out, let me know."
First off, it's "fasload()", not "funload()" as I said originally. Sorry
for the typo!
Second, AKCL and KCL seem to have different ideas as to what constitutes
the fasload/faslink combo, with the AKCL side doing some things rather
strangely (AKCL 1.179). First, the kcl side:
In unixfasl.c, the routine fasload() is defined for both BSD and SYSV systems.
Its job is to look at a "fasl" file (a .o produced by kcl that has some special
data appended to it) and do the following:
1. See how big the text, data and bss are and malloc() sufficient space.
2. Read the special data at the end into a lisp object (type "object" in C)
3. Use ld create a new intermediate object file by incrementally linking the
fasl file against the original kcl executable (never strip saved_kcl, for
this reason!) at the address of the malloc'd space. In sysV, this is done
by "ild" (the incremental loader) since the stock ld does not support -A.
I had to write this program myself, using an ld param file that specified
the kcl binary as a "NOLOAD" section.
There are several examples of ild implementations in the kcl/ild directory
if you're completely lost.
4. Open the intermediate object as an ordinary unix file, skip past the
header and read textsize + datasize bytes (the intermediate object
will have no bss) into the malloc'd memory.
5. Treat pointer to memory as a function pointer, passing address of memory,
length of memory and "special data object" as parameters to call. This
essentially calls the first function in the original fasl file.
The routine faslink() is defined only for BSD. It functions similar to
fasload(), except it does things in two passes. First, it combines
any ancillary objects and libraries together with the faslfile and
i-loads them with the kcl object (the address is set to the end of the heap).
Then it reads the intermediate file produced for the text+data+bss size of
everything and allocates the memory. Everything after that goes much the
same as in fasload().
On sysV, if you manage to get fasload() working, it's actually not all
that hard to get faslink() working as well. Just remember to link the
first stage object with -r (using an ild that understands how to pass
the extra object/library files to ld) and then do the fasload() steps
on the intermediate binary. I'd be happy to provide more information
on this step, if anyone is interested.
P.S. Someone tried to send me the "how to" doc on getting PCL/CLX/CLUE
up under AKCL, but I only got one line. Could you re-send it?
Jordan Hubbard
PCS Computer Systems.
--
--------
Jordan Hubbard
PCS Computer Systeme GmbH
West Germany
UUCP: pyramid!pcsbst!jkh ···@meepmeep.pcs.com
EUNET: unido!pcsbst!jkh
ARPA: ···@violet.berkeley.edu ·······@decwrl.dec.com