Skip to content
Snippets Groups Projects
Commit e726b100 authored by rtoy's avatar rtoy
Browse files

No functional changes. Just update and clarify comments.

parent 066d6439
No related branches found
No related tags found
No related merge requests found
/* /*
* main() entry point for a stand alone lisp image. * main() entry point for a stand alone lisp image.
* *
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.75 2010/08/01 12:32:11 agoncharov Exp $ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.76 2010/08/01 14:47:14 rtoy Exp $
* *
*/ */
...@@ -375,19 +375,32 @@ prepend_core_path(const char *lib, const char *corefile) ...@@ -375,19 +375,32 @@ prepend_core_path(const char *lib, const char *corefile)
} }
/* /*
The symbol builtin_image_flag is used globally as a flag to indicate * The value of the variable builtin_image_flag indicate whther the
whether the executable contains the lisp image. Note that we use * executable contains the lisp image or not. The variable
the linker to set the value of the symbol. But the symbol is an * initial_function_addr indicates the address of the initial
address, not a variable value. So for this to work as a flag, it * function. How these are interpreted depends on the system.
must end up pointing to a valid place in memory or we'll get a bus *
error or segmentation violation when we check it. If the lisp image * For Linux/x86, Darwin/x86, and Solaris/sparc, the
is built in, we'll set this symbol to point to the beginning of the * builtin_image_flag is a normal symbol mapped into a normal data
process. * area. If true, the executable contains the lisp image. Likewise,
* initial_function_addr is a symbol mapped into a normal data area.
We also use the linker to set initial_function_addr so that if the * The value of this variable is the address of the initial function.
lisp core is built in, taking the address of initial_function_addr *
will give the address of the initial function. * For other systems, we use the linker to set the value of the symbol.
*/ * But the symbol is an address, not a variable value. So for this to
* work as a flag, it must end up pointing to a valid place in memory
* or we'll get a bus error or segmentation violation when we check
* it. If the lisp image is built in, we'll set this symbol to point
* to the beginning of the process.
*
* We also use the linker to set initial_function_addr so that if the
* lisp core is built in, taking the address of initial_function_addr
* will give the address of the initial function.
*
* The details of how these variables are set up are in
* tools/linker.sh and tools/linker-x86.sh. Which script is used is
* set in src/lisp/elf.h.
*/
extern int builtin_image_flag; extern int builtin_image_flag;
extern long initial_function_addr; extern long initial_function_addr;
...@@ -618,9 +631,11 @@ main(int argc, const char *argv[], const char *envp[]) ...@@ -618,9 +631,11 @@ main(int argc, const char *argv[], const char *envp[])
cmucllib = strdup(libvar); cmucllib = strdup(libvar);
} else } else
#if defined FEATURE_EXECUTABLE #if defined FEATURE_EXECUTABLE
/* The following doesn't make sense for executables. /*
They need to use the saved library path from the * The following doesn't make sense for executables. They
lisp from which they were dumped. */ * need to use the saved library path from the lisp from
* which they were dumped.
*/
if (builtin_image_flag == 0) if (builtin_image_flag == 0)
#endif #endif
{ {
...@@ -679,8 +694,10 @@ main(int argc, const char *argv[], const char *envp[]) ...@@ -679,8 +694,10 @@ main(int argc, const char *argv[], const char *envp[])
} }
#if defined FEATURE_EXECUTABLE #if defined FEATURE_EXECUTABLE
} else { } else {
/* The "core file" is the executable. We have to save the /*
* executable path because we operate on the executable file later. * The "core file" is the executable. We have to save the
* executable path because we operate on the executable file
* later.
*/ */
core = argv[0]; core = argv[0];
} }
...@@ -755,10 +772,11 @@ main(int argc, const char *argv[], const char *envp[]) ...@@ -755,10 +772,11 @@ main(int argc, const char *argv[], const char *envp[])
/* Set cmucllib and cmuclcore appropriately */ /* Set cmucllib and cmuclcore appropriately */
#if defined FEATURE_EXECUTABLE #if defined FEATURE_EXECUTABLE
/* This test will preserve the library: search list dumped /*
with the executable unless the user specifically overrides * This test will preserve the library: search list dumped with
it with the -lib flag or by setting the CMUCLLIB environment * the executable unless the user specifically overrides it with
variable. */ * the -lib flag or by setting the CMUCLLIB environment variable.
*/
if (cmucllib) if (cmucllib)
#endif #endif
SetSymbolValue(CMUCL_LIB, alloc_string(cmucllib)); SetSymbolValue(CMUCL_LIB, alloc_string(cmucllib));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment