CMUCL commit: src/lisp (lisp.c)

Raymond Toy rtoy at common-lisp.net
Sun Aug 1 16:47:15 CEST 2010


    Date: Sunday, August 1, 2010 @ 10:47:14
  Author: rtoy
    Path: /project/cmucl/cvsroot/src/lisp

Modified: lisp.c

No functional changes.  Just update and clarify comments.


--------+
 lisp.c |   64 ++++++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 41 insertions(+), 23 deletions(-)


Index: src/lisp/lisp.c
diff -u src/lisp/lisp.c:1.75 src/lisp/lisp.c:1.76
--- src/lisp/lisp.c:1.75	Sun Aug  1 08:32:11 2010
+++ src/lisp/lisp.c	Sun Aug  1 10:47:14 2010
@@ -1,7 +1,7 @@
 /*
  * main() entry point for a stand alone lisp image.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/lisp.c,v 1.75 2010-08-01 12:32:11 agoncharov Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/lisp.c,v 1.76 2010-08-01 14:47:14 rtoy Exp $
  *
  */
 
@@ -375,19 +375,32 @@
 }
 
 /*
-  The symbol builtin_image_flag is used globally as a flag to indicate
-  whether the executable contains the lisp image.  Note that 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 value of the variable builtin_image_flag indicate whther the
+ * executable contains the lisp image or not.  The variable
+ * initial_function_addr indicates the address of the initial
+ * function.  How these are interpreted depends on the system.
+ *
+ * For Linux/x86, Darwin/x86, and Solaris/sparc, the
+ * builtin_image_flag is a normal symbol mapped into a normal data
+ * area.  If true, the executable contains the lisp image.  Likewise,
+ * initial_function_addr is a symbol mapped into a normal data area.
+ * The value of this variable is 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 long initial_function_addr;
@@ -618,9 +631,11 @@
 	    cmucllib = strdup(libvar);
 	} else
 #if defined FEATURE_EXECUTABLE
-	    /* The following doesn't make sense for executables.
-	       They need to use the saved library path from the
-	       lisp from which they were dumped. */
+	    /*
+             * The following doesn't make sense for executables.  They
+             * need to use the saved library path from the lisp from
+             * which they were dumped.
+             */
 	    if (builtin_image_flag == 0)
 #endif
 	{
@@ -679,8 +694,10 @@
         }
 #if defined FEATURE_EXECUTABLE
     } 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];
     }
@@ -755,10 +772,11 @@
 
     /* Set cmucllib and cmuclcore appropriately */
 #if defined FEATURE_EXECUTABLE
-    /* This test will preserve the library: search list dumped
-       with the executable unless the user specifically overrides
-       it with the -lib flag or by setting the CMUCLLIB environment
-       variable. */
+    /*
+     * This test will preserve the library: search list dumped with
+     * the executable unless the user specifically overrides it with
+     * the -lib flag or by setting the CMUCLLIB environment variable.
+     */
     if (cmucllib)
 #endif
 	SetSymbolValue(CMUCL_LIB, alloc_string(cmucllib));



More information about the cmucl-commit mailing list