Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl (2.6.7+dfsga-26) unstable; urgency=high
 .
   * -- command line support, map-shared in unexec
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.7+dfsga.orig/configure
+++ gcl-2.6.7+dfsga/configure
@@ -4703,13 +4703,19 @@ fi
 done
 
 
-ac_fn_c_check_header_mongrel "$LINENO" "malloc/malloc.h" "ac_cv_header_malloc_malloc_h" "$ac_includes_default"
+for ac_header in malloc/malloc.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "malloc/malloc.h" "ac_cv_header_malloc_malloc_h" "$ac_includes_default"
 if test "x$ac_cv_header_malloc_malloc_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MALLOC_MALLOC_H 1
+_ACEOF
 
 else
   as_fn_error $? "need malloc.h on macosx" "$LINENO" 5
 fi
 
+done
 
 	ac_fn_c_check_member "$LINENO" "struct _malloc_zone_t" "memalign" "ac_cv_member_struct__malloc_zone_t_memalign" "
 		#include <malloc/malloc.h>
@@ -4730,9 +4736,14 @@ esac
 
 # sysconf
 
-ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
+for ac_header in unistd.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
 if test "x$ac_cv_header_unistd_h" = xyes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysconf in -lc" >&5
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UNISTD_H 1
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysconf in -lc" >&5
 $as_echo_n "checking for sysconf in -lc... " >&6; }
 if ${ac_cv_lib_c_sysconf+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -4889,6 +4900,7 @@ fi
 
 fi
 
+done
 
 
 
@@ -4905,9 +4917,14 @@ if test $use_gmp = yes ; then
 
  PATCHED_SYMBOLS=""
  if test "$enable_dynsysgmp" = "yes" ; then
-	ac_fn_c_check_header_mongrel "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"
+	for ac_header in gmp.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"
 if test "x$ac_cv_header_gmp_h" = xyes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __gmpz_init in -lgmp" >&5
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GMP_H 1
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __gmpz_init in -lgmp" >&5
 $as_echo_n "checking for __gmpz_init in -lgmp... " >&6; }
 if ${ac_cv_lib_gmp___gmpz_init+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -4989,6 +5006,7 @@ else
   echo "Cannot use dynamic gmp lib"
 fi
 
+done
 
 fi
 
@@ -5540,9 +5558,14 @@ $as_echo "#define USE_DLOPEN 1" >>confde
 fi
 
 if test "$enable_statsysbfd" = "yes" || test "$enable_dynsysbfd" = "yes" ; then
-	ac_fn_c_check_header_mongrel "$LINENO" "bfd.h" "ac_cv_header_bfd_h" "$ac_includes_default"
+	for ac_header in bfd.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "bfd.h" "ac_cv_header_bfd_h" "$ac_includes_default"
 if test "x$ac_cv_header_bfd_h" = xyes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_init in -lbfd" >&5
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_BFD_H 1
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_init in -lbfd" >&5
 $as_echo_n "checking for bfd_init in -lbfd... " >&6; }
 if ${ac_cv_lib_bfd_bfd_init+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -5630,6 +5653,7 @@ fi
 
 fi
 
+done
 
 
 
@@ -5812,7 +5836,7 @@ if test "$enable_locbfd" = "yes" ; then
 
 	# check for gettext.  It is part of glibc, but others
 	# need GNU gettext separately.
-#	AC_CHECK_HEADER(libintl.h, true,
+#	AC_CHECK_HEADERS(libintl.h, true,
 #			   AC_MSG_ERROR(libintl.h (gettext) not found))
 #	AC_SEARCH_LIBS(dgettext, intl, true, AC_MSG_ERROR(gettext library not found))
 
@@ -6410,6 +6434,12 @@ rm -f core *.core core.conftest.* gmon.o
 fi
 
 
+if test "$use" = "386-macosx" ; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: emulating sbrk for mac" >&5
+$as_echo "emulating sbrk for mac" >&6; };
+   HAVE_SBRK=0
+fi
+
 if test "$HAVE_SBRK" = "1" ; then
 
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ADDR_NO_RANDOMIZE constant" >&5
--- gcl-2.6.7+dfsga.orig/configure.in
+++ gcl-2.6.7+dfsga/configure.in
@@ -679,7 +679,7 @@ fi
 
 case $use in
      *macosx)
-        AC_CHECK_HEADER(malloc/malloc.h,,[AC_MSG_ERROR([need malloc.h on macosx])])
+        AC_CHECK_HEADERS(malloc/malloc.h,,[AC_MSG_ERROR([need malloc.h on macosx])])
 	AC_CHECK_MEMBER([struct _malloc_zone_t.memalign],
  		AC_DEFINE(HAVE_MALLOC_ZONE_MEMALIGN,1,[memalign element present]), [], 
 		[
@@ -694,7 +694,7 @@ esac
 
 # sysconf
 
-AC_CHECK_HEADER(unistd.h,
+AC_CHECK_HEADERS(unistd.h,
 	AC_CHECK_LIB(c,sysconf,
 		AC_MSG_CHECKING(_SC_CLK_TCK)
 		AC_TRY_RUN([#include <unistd.h>
@@ -740,7 +740,7 @@ if test $use_gmp = yes ; then
 
  PATCHED_SYMBOLS=""
  if test "$enable_dynsysgmp" = "yes" ; then
-	AC_CHECK_HEADER(gmp.h,
+	AC_CHECK_HEADERS(gmp.h,
 		AC_CHECK_LIB(gmp,__gmpz_init,
 			AC_MSG_CHECKING("for external gmp version")
 			AC_TRY_RUN([#include <gmp.h>
@@ -944,7 +944,7 @@ dnl	TLIBS="$TLIBS -rdynamic"
 fi
 
 if test "$enable_statsysbfd" = "yes" || test "$enable_dynsysbfd" = "yes" ; then
-	AC_CHECK_HEADER(bfd.h,
+	AC_CHECK_HEADERS(bfd.h,
 		AC_CHECK_LIB(bfd,bfd_init,
 		#
 		# Old binutils appear to need CONST defined to const
@@ -1032,7 +1032,7 @@ if test "$enable_locbfd" = "yes" ; then
 
 	# check for gettext.  It is part of glibc, but others
 	# need GNU gettext separately.
-#	AC_CHECK_HEADER(libintl.h, true,
+#	AC_CHECK_HEADERS(libintl.h, true,
 #			   AC_MSG_ERROR(libintl.h (gettext) not found))
 #	AC_SEARCH_LIBS(dgettext, intl, true, AC_MSG_ERROR(gettext library not found))
  
@@ -1252,6 +1252,11 @@ AC_TRY_RUN([#include <unistd.h>
 		AC_MSG_RESULT([no: WARNING you must be able to emulate sbrk: as on mingw or macosx]),
 		AC_MSG_RESULT([no: WARNING you must be able to emulate sbrk: as on mingw or macosx]))
 
+if test "$use" = "386-macosx" ; then
+   AC_MSG_RESULT(emulating sbrk for mac);
+   HAVE_SBRK=0
+fi
+
 if test "$HAVE_SBRK" = "1" ; then
 
    AC_MSG_CHECKING([for ADDR_NO_RANDOMIZE constant])
--- gcl-2.6.7+dfsga.orig/h/gclincl.h.in
+++ gcl-2.6.7+dfsga/h/gclincl.h.in
@@ -63,6 +63,9 @@
 /* bfd_boolean defined */
 #undef HAVE_BFD_BOOLEAN
 
+/* Define to 1 if you have the <bfd.h> header file. */
+#undef HAVE_BFD_H
+
 /* have bsdgettimeofday */
 #undef HAVE_BSDGETTIMEOFDAY
 
@@ -93,6 +96,9 @@
 /* Define to 1 if you have the `getwd' function. */
 #undef HAVE_GETWD
 
+/* Define to 1 if you have the <gmp.h> header file. */
+#undef HAVE_GMP_H
+
 /* gnu linker present */
 #undef HAVE_GNU_LD
 
@@ -117,6 +123,9 @@
 /* long long is available */
 #undef HAVE_LONG_LONG
 
+/* Define to 1 if you have the <malloc/malloc.h> header file. */
+#undef HAVE_MALLOC_MALLOC_H
+
 /* memalign element present */
 #undef HAVE_MALLOC_ZONE_MEMALIGN
 
@@ -222,9 +231,6 @@
 /* size of immediate fixnum address space */
 #undef IM_FIX_LIM
 
-/* Have builtin_inf */
-#undef INFINITY
-
 /* symbol name mangling convention */
 #undef LEADING_UNDERSCORE
 
@@ -240,9 +246,6 @@
 /* sizeof mp_limb in gmp library */
 #undef MP_LIMB_BYTES
 
-/* Have builtin_nan */
-#undef NAN
-
 /* binutils requires CONST definition */
 #undef NEED_CONST
 
--- gcl-2.6.7+dfsga.orig/h/page.h
+++ gcl-2.6.7+dfsga/h/page.h
@@ -5,7 +5,6 @@
 #ifndef page
 #define page(p)	(((unsigned long)(p))>>PAGEWIDTH)
 #define	pagetochar(x)	((char *)((((unsigned long)x) << PAGEWIDTH) + sizeof(struct pageinfo)))
-/* #define pageinfo(x) ((struct pageinfo *)((((ufixnum)x)>>PAGEWIDTH)<<PAGEWIDTH)) */
 #define pageinfo(x) ((struct pageinfo *)(((ufixnum)x)&(-PAGESIZE)))
 #define pagetoinfo(x) ((struct pageinfo *)((((ufixnum)x)<<PAGEWIDTH)))
 #endif
@@ -128,6 +127,6 @@ EXTER void *data_start;
 #endif
 
 #define npage(m_) (((m_)+PAGESIZE-1)/PAGESIZE)
-#define cpage(m_) ((1+sizeof(struct pageinfo)+((CPTR_SIZE*CHAR_SIZE*(m_))/(CPTR_SIZE*CHAR_SIZE-1))+PAGESIZE-1)/PAGESIZE)
+#define cpage(m_) ({ufixnum _m=(m_);((1+sizeof(struct pageinfo)+_m+(_m/(CPTR_SIZE*CHAR_SIZE-1))+PAGESIZE-1)/PAGESIZE);})
 #define mbytes(p_) (((p_)*PAGESIZE-sizeof(struct pageinfo)+(CPTR_SIZE*CHAR_SIZE)-1)/(CPTR_SIZE*CHAR_SIZE))
 #define tpage(tm_,m_) (tm_->tm_type==t_contiguous ? cpage(m_) : npage(m_))
--- gcl-2.6.7+dfsga.orig/lsp/gcl_top.lsp
+++ gcl-2.6.7+dfsga/lsp/gcl_top.lsp
@@ -38,10 +38,10 @@
 
 (export '(vs ihs-vs ihs-fun frs-vs frs-bds frs-ihs bds-var bds-val super-go))
 
-(eval-when (compile) (proclaim '(optimize (safety 2) (space 3))
-			       )
-	   (defvar *command-args* nil)
-	   )
+(eval-when 
+    (compile)
+  (proclaim '(optimize (safety 2) (space 3)))
+  (defvar *command-args* nil))
 
 (defvar +)
 (defvar ++)
@@ -94,11 +94,13 @@
       (progn 
 	(cond
 	 (*multiply-stacks* (setq *multiply-stacks* nil))
-	 ((probe-file "init.lsp") (load "init.lsp")))
-	(let (*load-verbose*) (process-some-args *command-args*))
-	)
+	 ((probe-file "init.lsp") (load "init.lsp"))))
       (and (functionp *top-level-hook*)(funcall   *top-level-hook*)))
 
+    (when (boundp '*system-banner*)
+      (format t *system-banner*)
+      (format t "Temporary directory for compiler files set to ~a~%" *tmp-dir*))
+
     (loop
       (setq +++ ++ ++ + + -)
       (if *no-prompt* (setq *no-prompt* nil)
@@ -124,22 +126,41 @@
         (terpri *error-output*)
         (break-current)))))
 
-(defun process-some-args (args)
-  (loop
-   (let ((x (car args))
-	 y)
-     (cond ((equal x "-load")
-	    (load (second args)))
-	   ((equal x "-eval")
-	    (eval (read-from-string (second args))))
-	   (t (setq y t)))
-     (or y (setq args (cdr args)))
-     (setq args (cdr args)))
-   (or args (return nil))))  
-  
-
+(defun set-dir (sym val)
+   (let ((tem (or val (and (boundp sym) (symbol-value sym)))))
+      (if tem (set sym (coerce-slash-terminated tem)))))
 
+(defvar *error-p* nil)
 
+(defun process-some-args (args &optional compile &aux *load-verbose*)
+  (when args
+    (let ((x (pop args)))
+      (cond ((equal x "-load") (load (pop args)))
+	    ((equal x "-eval") (eval (read-from-string (pop args))))
+	    ((equal x "-batch") (setq *top-level-hook* 'bye))
+	    ((equal x "-o-file") (unless (read-from-string (car args))
+				   (push (cons :o-file nil) compile)
+				   (pop args)))
+	    ((equal x "-h-file") (push (cons :h-file t) compile))
+	    ((equal x "-data-file") (push (cons :data-file t) compile))
+	    ((equal x "-c-file") (push (cons :c-file t) compile))
+	    ((equal x "-system-p") (push (cons :system-p t) compile))
+	    ((equal x "-compile") (push (cons :compile (pop args)) compile))
+	    ((equal x "-o") (push (cons :o (pop args)) compile))
+	    ((equal x "-libdir") (set-dir '*lib-directory* (pop args)))
+	    ((equal x "-dir") (set-dir '*system-directory* (pop args)))
+	    ((equal x "-f") (do-f (car (setq *command-args* args))))
+	    ((equal x "--") (setq *command-args* args args nil))))
+    (process-some-args args compile))
+
+  (when compile
+    (let* (*break-enable* 
+	   (file (cdr (assoc :compile compile)))
+	   (o (cdr (assoc :o compile)))
+	   (compile (remove :o (remove :compile compile :key 'car) :key 'car))
+	   (compile (cons (cons :output-file (or o file)) compile))
+	   (result (system:error-set `(apply 'compile-file ,file ',(mapcan (lambda (x) (list (car x) (cdr x))) compile)))))
+      (bye (if (or *error-p* (equal result '(nil))) 1 0)))))
 
 (defun dbl-read (&optional (stream *standard-input*) (eof-error-p t)
 			   (eof-value nil)  &aux tem  ch)
@@ -699,29 +720,6 @@ First directory is checked for first nam
 
 (eval-when (compile) (proclaim '(optimize (safety 0))) )
 (defvar si::*command-args* nil)
-(defun si::get-command-arg (a &optional val-if-there &aux (v *command-args*))
-  (declare (string a))
-  ;; return non nil if annnnxu is in si::*command-args* and return
-  ;; the string which is after it if there is one"
-  (loop
-    (setq v (cdr v))
-    (or v (return nil))
-    (let ((str (car v)))
-      (declare (string str))
-      (if (and (eql  (aref str 0) (aref a 0))
-	       (eql  (aref str 1) (aref a 1))
-	       (equal str a))
-	  (return
-	  (cond (val-if-there)
-		((cadr v)(values (cadr v) (cdr v)))
-		(t t)))))))
-
-; (let ((tem (member a si::*command-args* :test 'equal)))
-;    (if tem (or  val-if-there (cadr tem) t))))
-
-(defun set-dir (sym flag)
-   (let ((tem (or (si::get-command-arg flag) (and (boundp sym) (symbol-value sym)))))
-      (if tem (set sym (coerce-slash-terminated tem)))))
 
 (defvar *tmp-dir*)
 
@@ -750,45 +748,42 @@ First directory is checked for first nam
 			  (append (pathname-directory x) (list (pathname-name x))))))))))))
 
 
-(defun set-up-top-level ( &aux (i (argc)) tem)
+(defun set-up-top-level (&aux (i (argc)) tem)
   (declare (fixnum i))
-  (loop (setq i (- i 1))
-	(cond ((< i 0)(return nil))
-	      (t (setq tem (cons (argv i) tem)))))
-  (setq *command-args* tem)
   (setq *tmp-dir* (get-temp-dir))
+  (dotimes (j i) (push (argv j) tem))
+  (setq *command-args* (nreverse tem))
   (setq tem *lib-directory*)
-  (let ((dir (getenv "GCL_LIBDIR")))
-    (or (set-dir  '*lib-directory* "-libdir")
-	(if dir (setq *lib-directory* (coerce-slash-terminated dir))))
-    (unless
-     (and *load-path* (equal tem *lib-directory*))
-     (setq *load-path* (cons (string-concatenate *lib-directory*
-						     "lsp/") *load-path*))
-     (setq *load-path* (cons (string-concatenate *lib-directory*
-						     "gcl-tk/") *load-path*))
-     (setq *load-path* (cons (string-concatenate *lib-directory*
-						     "xgcl-2/") *load-path*)))
-    (when (not (boundp '*system-directory*)) 
-      (setq *system-directory* (namestring
-        (truename (make-pathname :name nil :type nil :defaults (argv 0))))))
-    (set-dir '*system-directory* "-dir")
-    (if (multiple-value-setq (tem tem) (get-command-arg "-f"))
-	(let (*load-verbose*)
-	  (process-some-args *command-args*)
-	  (setq *command-args* tem)
-	  (do-f (car *command-args*))))))
-
-(defun do-f (file )
-  (let ((eof '(nil)) tem
-	*break-enable*)
-    (catch *quit-tag*
-      (with-open-file (st file)
-		      (READ-LINE ST)
-		      (LOOP
-		       (SETQ TEM (READ ST NIL EOF))
-		       (COND ((EQ EOF TEM) (return nil)))
-		       (EVAL TEM)))
+  (process-some-args *command-args*)
+  (unless *lib-directory*
+    (let ((dir (getenv "GCL_LIBDIR")))
+      (when dir
+	(setq *lib-directory* (coerce-slash-terminated dir)))))
+  (unless (and *load-path* (equal tem *lib-directory*))
+    (setq *load-path* (cons (string-concatenate *lib-directory* "lsp/") *load-path*))
+    (setq *load-path* (cons (string-concatenate *lib-directory* "gcl-tk/") *load-path*))
+    (setq *load-path* (cons (string-concatenate *lib-directory*  "xgcl-2/") *load-path*)))
+  (unless (boundp '*system-directory*)
+    (setq *system-directory* (namestring (truename (make-pathname :name nil :type nil :defaults (argv 0))))))))
+
+(defvar *old-top-level* #'top-level)
+
+(defun gcl-top-level nil
+  
+  (set-up-top-level)
+  
+  (in-package :user)
+  (setq *ihs-top* 3)
+  (funcall *old-top-level*))
+ 
+(defun do-f (file &aux *break-enable*)
+  (catch *quit-tag*
+      (with-open-file
+       (st file)
+       (read-line st)
+       (loop
+	(let ((tem (read st nil 'eof)))
+	  (if (eq 'eof tem) (return nil) (eval tem)))))
       (bye))
-      (bye 1)
-      ))
+  (bye 1))
+
--- gcl-2.6.7+dfsga.orig/lsp/sys-proclaim.lisp
+++ gcl-2.6.7+dfsga/lsp/sys-proclaim.lisp
@@ -1,6 +1,6 @@
 
 (IN-PACKAGE "SYSTEM") 
-(PROCLAIM '(FTYPE (FUNCTION (T *) T) ERROR))
+(PROCLAIM '(FTYPE (FUNCTION (T *) T) PROCESS-SOME-ARGS ERROR))
 (PROCLAIM '(FTYPE (FUNCTION (T T) T) GETHASH1))
 (PROCLAIM '(FTYPE (FUNCTION (T T FIXNUM) T) STRUCTURE-REF))
 (PROCLAIM '(FTYPE (FUNCTION (T T FIXNUM T) T) STRUCTURE-SET))
@@ -220,7 +220,7 @@
             SERROR::ERROR-CONDITION-P PRINT-SYMBOL-APROPOS
             ANSI-LOOP::LOOP-COLLECTOR-NAME ANSI-LOOP::LOOP-MINIMAX-TYPE
             ANSI-LOOP::LOOP-MINIMAX-TEMP-VARIABLE
-            ANSI-LOOP::LOOP-MINIMAX-FLAG-VARIABLE PROCESS-SOME-ARGS
+            ANSI-LOOP::LOOP-MINIMAX-FLAG-VARIABLE 
             ANSI-LOOP::LOOP-EMIT-FINAL-VALUE
             ANSI-LOOP::LOOP-MINIMAX-OPERATIONS
             ANSI-LOOP::LOOP-MINIMAX-INFINITY-DATA
--- gcl-2.6.7+dfsga.orig/man/man1/gcl.1
+++ gcl-2.6.7+dfsga/man/man1/gcl.1
@@ -54,6 +54,12 @@ are understood:
 Call read and then eval on the
 .I command passed in.
 .TP
+.B \-\-
+.RB
+Stop processing arguments, setting si::*command-args* to a list
+containing the arguments after the
+.BR \-\- .
+.TP
 .BR \-load\ pathname
 .RB
 Load the file whose
@@ -62,11 +68,11 @@ is specified after
 .BR \-load .
 .TP
 .B \-f
-Replace si::*command-args* by the the list starting after
-.BR \-f .
 Open the file following
 .BR \-f  for input, skip the first line, and
-then read and eval the rest of the forms in the file.   This can
+then read and eval the rest of the forms in the file.
+Replaces si::*command-args* by the the list starting after
+.BR \-f .   This can
 be used as with the shells to write small shell programs:
 
 .LP
--- gcl-2.6.7+dfsga.orig/o/unexelf.c
+++ gcl-2.6.7+dfsga/o/unexelf.c
@@ -688,13 +688,13 @@ unexec (char *new_name, char *old_name,
      extra careful to use the correct value of sbrk(0) after
      allocating all buffers in the code below, which we aren't.  */
   old_file_size = stat_buf.st_size;
-  old_base = mmap (NULL, old_file_size, PROT_READ | PROT_WRITE,
-		   MAP_ANON | MAP_PRIVATE, mmap_fd, 0);
+  old_base = mmap (NULL, old_file_size, PROT_READ,MAP_SHARED, old_file, 0);
   if (old_base == MAP_FAILED)
     fatal ("Can't allocate buffer for %s\n", old_name);
 
-  if (read (old_file, old_base, stat_buf.st_size) != stat_buf.st_size)
-    fatal ("Didn't read all of %s: errno %d\n", old_name, errno);
+  /* errno=0; */
+  /* if (read (old_file, old_base, stat_buf.st_size) != stat_buf.st_size) */
+  /*   fatal ("Didn't read all of %s: errno %d\n", old_name, errno); */
 
   /* Get pointers to headers & section names */
 
@@ -778,8 +778,7 @@ unexec (char *new_name, char *old_name,
   if (ftruncate (new_file, new_file_size))
     fatal ("Can't ftruncate (%s): errno %d\n", new_name, errno);
 
-  new_base = mmap (NULL, new_file_size, PROT_READ | PROT_WRITE,
-		   MAP_ANON | MAP_PRIVATE, mmap_fd, 0);
+  new_base = mmap (NULL, new_file_size, PROT_READ | PROT_WRITE,MAP_SHARED, new_file, 0);
   if (new_base == MAP_FAILED)
     fatal ("Can't allocate buffer for %s\n", old_name);
 
@@ -1208,9 +1207,9 @@ unexec (char *new_name, char *old_name,
 
   /* Write out new_file, and free the buffers.  */
 
-  if (write (new_file, new_base, new_file_size) != new_file_size)
-    fatal ("Didn't write %d bytes to %s: errno %d\n",
-	   new_file_size, new_base, errno);
+  /* if (write (new_file, new_base, new_file_size) != new_file_size) */
+  /*   fatal ("Didn't write %d bytes to %s: errno %d\n", */
+  /* 	   new_file_size, new_base, errno); */
 
   munmap (old_base, old_file_size);
   munmap (new_base, new_file_size);
--- gcl-2.6.7+dfsga.orig/unixport/init_pcl_gcl.lsp.in
+++ gcl-2.6.7+dfsga/unixport/init_pcl_gcl.lsp.in
@@ -58,47 +58,9 @@
  
  (setf (symbol-function 'si:clear-compiler-properties)
        (symbol-function 'compiler::compiler-clear-compiler-properties))
- (setq system::*old-top-level* (symbol-function 'system:top-level))
  
  (defvar si::*lib-directory* (namestring (make-pathname :directory (list :parent))))
  
- (defun system::gcl-top-level (&aux tem)
-   (si::set-up-top-level)
-   
-   (if (si::get-command-arg "-compile")
-       (let (;(system::*quit-tag* (cons nil nil))
-		;(system::*quit-tags* nil) (system::*break-level* '())
-		;(system::*break-env* nil) (system::*ihs-base* 1)
-		;(system::*ihs-top* 1) (system::*current-ihs* 1)
-	     (*break-enable* nil) result)
-	 (setq result
-	       (system:error-set
-		'(progn
-		   (compile-file
-		    (si::get-command-arg "-compile")
-		    :output-file 
-		    (or (si::get-command-arg "-o")
-			(si::get-command-arg "-compile"))
-		    :o-file
-		    (cond ((equalp
-			    (si::get-command-arg "-o-file")
-			    "nil") nil)
-			  ((si::get-command-arg "-o-file" t))
-			  (t t))
-		    :c-file (si::get-command-arg "-c-file" t)
-		    :h-file (si::get-command-arg "-h-file" t)
-		    :data-file (si::get-command-arg "-data-file" t)
-		    :system-p (si::get-command-arg "-system-p" t)))))
-	 (bye (if (or compiler::*error-p* (equal result '(nil))) 1 0))))
-   (cond ((si::get-command-arg "-batch")
-	  (setq si::*top-level-hook* 'bye))
-	 ((si::get-command-arg "-f"))
-	 (t (format t si::*system-banner*)
-	    (format t "Temporary directory for compiler files set to ~a~%" *tmp-dir*)))
-   (setq si::*ihs-top* 1)
-   (in-package 'system::user) (incf system::*ihs-top* 2)
-   (funcall system::*old-top-level*))
- 
  (terpri)
  (setq si:*inhibit-macro-special* t)
  (gbc t) (system:reset-gbc-count)
--- gcl-2.6.7+dfsga.orig/unixport/init_pre_gcl.lsp.in
+++ gcl-2.6.7+dfsga/unixport/init_pre_gcl.lsp.in
@@ -51,47 +51,9 @@
  
  (setf (symbol-function 'si:clear-compiler-properties)
        (symbol-function 'compiler::compiler-clear-compiler-properties))
- (setq system::*old-top-level* (symbol-function 'system:top-level))
  
  (defvar si::*lib-directory* (namestring (make-pathname :directory (list :parent))))
  
- (defun system::gcl-top-level (&aux tem)
-   (si::set-up-top-level)
-   
-   (if (si::get-command-arg "-compile")
-       (let (;(system::*quit-tag* (cons nil nil))
-					;(system::*quit-tags* nil) (system::*break-level* '())
-					;(system::*break-env* nil) (system::*ihs-base* 1)
-					;(system::*ihs-top* 1) (system::*current-ihs* 1)
-	     (*break-enable* nil) result)
-	 (setq result
-	       (system:error-set
-		'(progn
-		   (compile-file
-		    (si::get-command-arg "-compile")
-		    :output-file 
-		    (or (si::get-command-arg "-o")
-			(si::get-command-arg "-compile"))
-		    :o-file
-		    (cond ((equalp
-			    (si::get-command-arg "-o-file")
-			    "nil") nil)
-			  ((si::get-command-arg "-o-file" t))
-			  (t t))
-		    :c-file (si::get-command-arg "-c-file" t)
-		    :h-file (si::get-command-arg "-h-file" t)
-		    :data-file (si::get-command-arg "-data-file" t)
-		    :system-p (si::get-command-arg "-system-p" t)))))
-	 (bye (if (or compiler::*error-p* (equal result '(nil))) 1 0))))
-   (cond ((si::get-command-arg "-batch")
-	  (setq si::*top-level-hook* 'bye))
-	 ((si::get-command-arg "-f"))
-	 (t (format t si::*system-banner*)
-	    (format t "Temporary directory for compiler files set to ~a~%" *tmp-dir*)))
-   (setq si::*ihs-top* 1)
-   (in-package 'system::user) (incf system::*ihs-top* 2)
-   (funcall system::*old-top-level*))
- 
  (terpri)
  (setq si:*inhibit-macro-special* t)
  (gbc t) (system:reset-gbc-count)
--- gcl-2.6.7+dfsga.orig/unixport/init_ansi_gcl.lsp.in
+++ gcl-2.6.7+dfsga/unixport/init_ansi_gcl.lsp.in
@@ -63,47 +63,9 @@
  
  (setf (symbol-function 'si:clear-compiler-properties)
        (symbol-function 'compiler::compiler-clear-compiler-properties))
- (setq system::*old-top-level* (symbol-function 'system:top-level))
  
  (defvar si::*lib-directory* (namestring (make-pathname :directory (list :parent))))
  
- (defun system::gcl-top-level (&aux tem)
-   (si::set-up-top-level)
-   
-   (if (si::get-command-arg "-compile")
-       (let (;(system::*quit-tag* (cons nil nil))
-		;(system::*quit-tags* nil) (system::*break-level* '())
-		;(system::*break-env* nil) (system::*ihs-base* 1)
-		;(system::*ihs-top* 1) (system::*current-ihs* 1)
-	     (*break-enable* nil) result)
-	 (setq result
-	       (system:error-set
-		'(progn
-		   (compile-file
-		    (si::get-command-arg "-compile")
-		    :output-file 
-		    (or (si::get-command-arg "-o")
-			(si::get-command-arg "-compile"))
-		    :o-file
-		    (cond ((equalp
-			    (si::get-command-arg "-o-file")
-			    "nil") nil)
-			  ((si::get-command-arg "-o-file" t))
-			  (t t))
-		    :c-file (si::get-command-arg "-c-file" t)
-		    :h-file (si::get-command-arg "-h-file" t)
-		    :data-file (si::get-command-arg "-data-file" t)
-		    :system-p (si::get-command-arg "-system-p" t)))))
-	 (bye (if (or compiler::*error-p* (equal result '(nil))) 1 0))))
-   (cond ((si::get-command-arg "-batch")
-	  (setq si::*top-level-hook* 'bye))
-	 ((si::get-command-arg "-f"))
-	 (t (format t si::*system-banner*)
-	    (format t "Temporary directory for compiler files set to ~a~%" *tmp-dir*)))
-   (setq si::*ihs-top* 1)
-   (in-package 'system::user) (incf system::*ihs-top* 2)
-   (funcall system::*old-top-level*))
- 
  (terpri)
  (setq si:*inhibit-macro-special* t)
  (gbc t) (system:reset-gbc-count)
--- gcl-2.6.7+dfsga.orig/unixport/init_gcl.lsp.in
+++ gcl-2.6.7+dfsga/unixport/init_gcl.lsp.in
@@ -50,47 +50,9 @@
  
  (setf (symbol-function 'si:clear-compiler-properties)
        (symbol-function 'compiler::compiler-clear-compiler-properties))
- (setq system::*old-top-level* (symbol-function 'system:top-level))
  
  (defvar si::*lib-directory* (namestring (make-pathname :directory (list :parent))))
  
- (defun system::gcl-top-level (&aux tem)
-   (si::set-up-top-level)
-   
-   (if (si::get-command-arg "-compile")
-       (let (;(system::*quit-tag* (cons nil nil))
-					;(system::*quit-tags* nil) (system::*break-level* '())
-					;(system::*break-env* nil) (system::*ihs-base* 1)
-					;(system::*ihs-top* 1) (system::*current-ihs* 1)
-	     (*break-enable* nil) result)
-	 (setq result
-	       (system:error-set
-		'(progn
-		   (compile-file
-		    (si::get-command-arg "-compile")
-		    :output-file 
-		    (or (si::get-command-arg "-o")
-			(si::get-command-arg "-compile"))
-		    :o-file
-		    (cond ((equalp
-			    (si::get-command-arg "-o-file")
-			    "nil") nil)
-			  ((si::get-command-arg "-o-file" t))
-			  (t t))
-		    :c-file (si::get-command-arg "-c-file" t)
-		    :h-file (si::get-command-arg "-h-file" t)
-		    :data-file (si::get-command-arg "-data-file" t)
-		    :system-p (si::get-command-arg "-system-p" t)))))
-	 (bye (if (or compiler::*error-p* (equal result '(nil))) 1 0))))
-   (cond ((si::get-command-arg "-batch")
-	  (setq si::*top-level-hook* 'bye))
-	 ((si::get-command-arg "-f"))
-	 (t (format t si::*system-banner*)
-	    (format t "Temporary directory for compiler files set to ~a~%" *tmp-dir*)))
-   (setq si::*ihs-top* 1)
-   (in-package 'system::user) (incf system::*ihs-top* 2)
-   (funcall system::*old-top-level*))
- 
  (terpri)
  (setq si:*inhibit-macro-special* t)
  (gbc t) (system:reset-gbc-count)
--- gcl-2.6.7+dfsga.orig/cmpnew/gcl_cmpmain.lsp
+++ gcl-2.6.7+dfsga/cmpnew/gcl_cmpmain.lsp
@@ -29,6 +29,7 @@
 
 (export '(*compile-print* *compile-verbose*))
 (import 'si::*tmp-dir* 'compiler)
+(import 'si::*error-p* 'compiler)
 
 ;;; This had been true with Linux 1.2.13 a.out or even older
 ;;; #+linux   (push :ld-not-accept-data  *features*)
@@ -43,8 +44,6 @@
 (defvar *compiler-output-data*)
 (defvar *compiler-output-i*)
 
-(defvar *error-p* nil)
-
 (defvar *compile-print* nil)
 (defvar *compile-verbose* t)
 (defvar *cmpinclude* "\"cmpinclude.h\"")
