From 4de992e83645284d324df1eaccf56cb5fe8dfd81 Mon Sep 17 00:00:00 2001
From: rtoy <rtoy>
Date: Mon, 13 Jul 2009 19:41:54 +0000
Subject: [PATCH] lisp/lisp.c: o Make debug_lisp_search global instead of
 static.

lisp/elf.c:
o Use debug_lisp_search to control printing of some debug information
  when searching for the linker script.
o Update to support executables with Unicode support.  (CMUCL_LIB is a
  wide string, so we need to hack that into a C string.  This needs
  work.)
---
 lisp/elf.c  | 34 ++++++++++++++++++++++++++++++----
 lisp/lisp.c |  4 ++--
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/lisp/elf.c b/lisp/elf.c
index 1fd117977..996503aa8 100644
--- a/lisp/elf.c
+++ b/lisp/elf.c
@@ -8,7 +8,7 @@
 
  Above changes put into main CVS branch. 05-Jul-2007.
 
- $Id: elf.c,v 1.18 2009/01/20 03:58:11 agoncharov Exp $
+ $Id: elf.c,v 1.19 2009/07/13 19:41:54 rtoy Rel $
 */
 
 #include <stdio.h>
@@ -331,19 +331,45 @@ elf_run_linker(long init_func_address, char *file)
 
     lispobj libstring = SymbolValue(CMUCL_LIB);     /* Get library: */
     struct vector *vec = (struct vector *)PTR(libstring);
-    char *paths = strdup((char *)vec->data);
+    char *paths;
     char command[FILENAME_MAX + 1];
     char command_line[FILENAME_MAX + FILENAME_MAX + 10];
     char *strptr;
     struct stat st;
     int ret;
-
+    extern int debug_lisp_search;
+#ifndef UNICODE
+    paths = strdup((char *)vec->data);
+#else
+    /*
+     * What should we do here with 16-bit characters?  For now we just
+     * take the low 8-bits.
+     */
+    paths = malloc(vec->length);
+    {
+        int k;
+        unsigned short *data;
+        data = (unsigned short*) vec->data;
+        
+        for (k = 0; k < vec->length; ++k) {
+            paths[k] = data[k] & 0xff;
+        }
+    }
+#endif
     strptr = strtok(paths, ":");
 
-    while(strptr != NULL) {
+    if (debug_lisp_search) {
+        printf("Searching for linker.sh script\n");
+    }
 
+    while(strptr != NULL) {
+        
 	sprintf(command, "%s/%s", strptr, LINKER_SCRIPT);
 
+        if (debug_lisp_search) {
+            printf("  %s\n", command);
+        }
+        
 	if(stat(command, &st) == 0) {
 	    free(paths);
 	    printf("\t[%s: linking %s... \n", command, file);
diff --git a/lisp/lisp.c b/lisp/lisp.c
index 18912e309..27ad22179 100644
--- a/lisp/lisp.c
+++ b/lisp/lisp.c
@@ -1,7 +1,7 @@
 /*
  * main() entry point for a stand alone lisp image.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.67 2009/01/20 03:58:11 agoncharov Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.68 2009/07/13 19:41:54 rtoy Rel $
  *
  */
 
@@ -91,7 +91,7 @@ static char *cmucllib_search_list[] = {
 
 
 /* Set this to see how we're doing our search */
-static int debug_lisp_search = FALSE;
+int debug_lisp_search = FALSE;
 
 /*
  * Define this to get some debugging printfs for searching for the
-- 
GitLab