Skip to content
Snippets Groups Projects
Commit 03dc5a7e authored by fgilham's avatar fgilham
Browse files

Incorporate Lisp executable changes

parent 9256fd1a
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.52 2007/07/06 08:04:39 cshapiro Exp $ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.53 2007/07/07 15:54:31 fgilham Exp $
* *
*/ */
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
#include "core.h" #include "core.h"
#include "save.h" #include "save.h"
#include "lispregs.h" #include "lispregs.h"
#ifdef EXECUTABLE
#include "elf.h"
#endif
...@@ -432,26 +435,25 @@ main(int argc, char *argv[], char *envp[]) ...@@ -432,26 +435,25 @@ main(int argc, char *argv[], char *envp[])
argptr = argv; argptr = argv;
while ((arg = *++argptr) != NULL) { while ((arg = *++argptr) != NULL) {
if (strcmp(arg, "-core") == 0) { if (strcmp(arg, "-core") == 0) {
#ifdef EXECUTABLE
if (builtin_image_flag) { if (builtin_image_flag) {
fprintf(stderr, fprintf(stderr, "Cannot specify alternate core file with executable image.\n");
"Cannot specify core file in executable image --- sorry about that.\n");
exit(1); exit(1);
} }
#endif
if (core != NULL) { if (core != NULL) {
fprintf(stderr, "can only specify one core file.\n"); fprintf(stderr, "can only specify one core file.\n");
exit(1); exit(1);
} }
core = *++argptr; core = *++argptr;
if (core == NULL) { if (core == NULL) {
fprintf(stderr, fprintf(stderr, "-core must be followed by the name of the core file to use.\n");
"-core must be followed by the name of the core file to use.\n");
exit(1); exit(1);
} }
} else if (strcmp(arg, "-lib") == 0) { } else if (strcmp(arg, "-lib") == 0) {
lib = *++argptr; lib = *++argptr;
if (lib == NULL) { if (lib == NULL) {
fprintf(stderr, fprintf(stderr, "-lib must be followed by a string denoting the CMUCL library path.\n");
"-lib must be followed by a string denoting the CMUCL library path.\n");
exit(1); exit(1);
} }
} else if (strcmp(arg, "-dynamic-space-size") == 0) { } else if (strcmp(arg, "-dynamic-space-size") == 0) {
...@@ -492,8 +494,7 @@ main(int argc, char *argv[], char *envp[]) ...@@ -492,8 +494,7 @@ main(int argc, char *argv[], char *envp[])
} }
#endif #endif
if (dynamic_space_size > DYNAMIC_SPACE_SIZE) { if (dynamic_space_size > DYNAMIC_SPACE_SIZE) {
fprintf(stderr, fprintf(stderr, "-dynamic-space-size must be no greater than %d MBytes.\n",
"-dynamic-space-size must be no greater than %d MBytes.\n",
DYNAMIC_SPACE_SIZE / (1024 * 1024)); DYNAMIC_SPACE_SIZE / (1024 * 1024));
exit(1); exit(1);
} }
...@@ -509,7 +510,7 @@ main(int argc, char *argv[], char *envp[]) ...@@ -509,7 +510,7 @@ main(int argc, char *argv[], char *envp[])
default_core = "lisp.core"; default_core = "lisp.core";
os_init(); os_init();
#if defined(__FreeBSD__) || defined(__linux__) #ifdef EXECUTABLE
if (builtin_image_flag != 0) if (builtin_image_flag != 0)
map_core_sections(argv[0]); map_core_sections(argv[0]);
#endif #endif
...@@ -585,7 +586,9 @@ main(int argc, char *argv[], char *envp[]) ...@@ -585,7 +586,9 @@ main(int argc, char *argv[], char *envp[])
/* Only look for a core file if we're not using a built-in image. */ /* Only look for a core file if we're not using a built-in image. */
#ifdef EXECUTABLE
if (builtin_image_flag == 0) { if (builtin_image_flag == 0) {
#endif
/* /*
* If no core file specified, search for it in CMUCLLIB * If no core file specified, search for it in CMUCLLIB
*/ */
...@@ -612,19 +615,20 @@ main(int argc, char *argv[], char *envp[]) ...@@ -612,19 +615,20 @@ main(int argc, char *argv[], char *envp[])
exit(1); exit(1);
} }
} }
#ifdef EXECUTABLE
} else { } else {
/* The "core file" is the executable. We have to do this /* The "core file" is the executable. We have to save the
* because this file actually gets checked for later." * executable path because we operate on the executable file later.
*/ */
core = argv[0]; core = argv[0];
} }
#endif
globals_init(); globals_init();
#ifdef EXECUTABLE
if (builtin_image_flag != 0) { if (builtin_image_flag != 0) {
extern int image_dynamic_space_size; extern int image_dynamic_space_size;
long allocation_pointer = long allocation_pointer =
(long) dynamic_0_space + (int) &image_dynamic_space_size; (long) dynamic_0_space + (int) &image_dynamic_space_size;
#if defined(i386) || defined(__x86_64) #if defined(i386) || defined(__x86_64)
SetSymbolValue(ALLOCATION_POINTER, (lispobj) allocation_pointer); SetSymbolValue(ALLOCATION_POINTER, (lispobj) allocation_pointer);
...@@ -634,6 +638,9 @@ main(int argc, char *argv[], char *envp[]) ...@@ -634,6 +638,9 @@ main(int argc, char *argv[], char *envp[])
} else { } else {
initial_function = load_core_file(core); initial_function = load_core_file(core);
} }
#else
initial_function = load_core_file(core);
#endif
#if defined LINKAGE_TABLE #if defined LINKAGE_TABLE
os_foreign_linkage_init(); os_foreign_linkage_init();
......
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