Wanted: a linkkit to produce standalone applications
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Incomplete
|
Low
|
Unassigned |
Bug Description
I have a wishlist item for SBCL: it would be self-enclosed
application delivery into a single executable that includes not only
the Lisp image, but also additional statically compiled C libraries.
CLISP has a "linkkit" for that, and ECL can do it, too.
If I understand what nyef told me, we might have to have some magic
linker script and function annotations to ensure that magic functions
are located at an address known to Lisp code despite new code being
linked into the .text and .data segments. Typically, we'd either
ensure the proper objects files are linked first, or you'd create a
magic segment(s) different from .text and/or .data, that starts at a
magic address, in which to compile the stuff that the Lisp image will
expect to be at a known address.
Is some SBCL hacker interested in doing that? Or maybe only add it to
the SBCL TODO file? Or maybe someone can explain me WHICH functions
and datastructures must be at a fixed address, and then I can try to
write the linker script myself using my experience from bootstrapping
kernels on a new machine.
Notes:
1- Nikodemus reports that everything that's in SB-SYS:
those addresses.
2- Raymond Toy reports that may already have done some/all of this for CMUCL, which may or may not be applicable to SBCL.
Changed in sbcl: | |
importance: | Undecided → Low |
status: | New → Triaged |
tags: | added: feature |
rtoy explains:
"Fred came up with the original idea, but at the time he only knew how to
do it by creating a custom linker script. I talked to him about it and
figured out gcc with a few special arguments would do the same thing.
That allowed me to extend the idea to work on solaris/sparc and even Mac
OS X.
The C side of the stuff is in src/lisp/elf.c and src/lisp/mach-o.c and
src/lisp/save.c, with a little bit of help from the lisp side in
src/code/save.lisp. elf.c and mach-o.c dump the three spaces into valid
elf or mach-o object files.
The script that does the linking is src/tools/ linker. sh. It takes the
arguments created by save.c and does the right thing on the various
supported architectures and calls gcc in the right way to tell the
executable that an image is attached and to append the three spaces onto
the end of the C executable."
NB: the current way to checkout CMUCL, not well documented, is: lisp.net: /project/ cmucl/cvsroot checkout src
cvs -d common-