385abae
Description: <short summary of the patch>
385abae
 TODO: Put a short summary on the line above and replace this paragraph
385abae
 with a longer explanation of this change. Complete the meta-information
385abae
 with other relevant fields (see below for details). To make it easier, the
385abae
 information below has been extracted from the changelog. Adjust it or drop
385abae
 it.
385abae
 .
385abae
 gcl (2.6.12-34) unstable; urgency=medium
385abae
 .
385abae
   * Version_2_6_13pre45
385abae
Author: Camm Maguire <camm@debian.org>
385abae
385abae
---
385abae
The information above should follow the Patch Tagging Guidelines, please
385abae
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
385abae
are templates for supplementary fields that you might want to add:
385abae
385abae
Origin: <vendor|upstream|other>, <url of original patch>
385abae
Bug: <url in upstream bugtracker>
385abae
Bug-Debian: https://bugs.debian.org/<bugnumber>
385abae
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
385abae
Forwarded: <no|not-needed|url proving that it has been forwarded>
385abae
Reviewed-By: <name and email of someone who approved the patch>
385abae
Last-Update: 2016-09-30
385abae
385abae
--- gcl-2.6.12.orig/cmpnew/gcl_cmpmain.lsp
385abae
+++ gcl-2.6.12/cmpnew/gcl_cmpmain.lsp
385abae
@@ -28,7 +28,7 @@
385abae
 
385abae
 
385abae
 (export '(*compile-print* *compile-verbose*))
385abae
-(import 'si::*tmp-dir* 'compiler)
385abae
+(import 'si::(*tmp-dir* *cc* *ld* *objdump*))
385abae
 (import 'si::*error-p* 'compiler)
385abae
 
385abae
 ;;; This had been true with Linux 1.2.13 a.out or even older
385abae
@@ -85,9 +85,8 @@
385abae
   (code result) (system (mysub (ts string) "$" "\\$"))
385abae
     (unless (and (zerop code) (zerop result))
385abae
       (cerror "Continues anyway."
385abae
-              "(SYSTEM ~S) returned a non-zero value ~D."
385abae
-              string
385abae
-              result)
385abae
+              "(SYSTEM ~S) returned a non-zero value ~D ~D."
385abae
+              string code result)
385abae
       (setq *error-p* t))
385abae
     (values result)))
385abae
 
385abae
@@ -428,8 +427,8 @@ Cannot compile ~a.~%"
385abae
 			     (si::copy-stream st *standard-output*))
385abae
 	     (with-open-file (st hn)
385abae
 			     (si::copy-stream st *standard-output*))
385abae
-	     (when (zerop (system "which objdump >/dev/null"))
385abae
-	       (safe-system (si::string-concatenate "objdump --source " (namestring on))))
385abae
+	     (when (eql (aref *objdump* 0) #\/);program found at startup in path
385abae
+	       (safe-system (si::string-concatenate *objdump* (namestring on))))
385abae
 	     (mdelete-file cn)
385abae
 	     (mdelete-file dn)
385abae
 	     (mdelete-file hn)
385abae
@@ -470,8 +469,6 @@ Cannot compile ~a.~%"
385abae
       (terpri *compiler-output2*)))))
385abae
 
385abae
 
385abae
-(defvar *cc* "cc")
385abae
-(defvar *ld* "ld")
385abae
 (defvar *ld-libs* "ld-libs")
385abae
 (defvar *opt-three* "")
385abae
 (defvar *opt-two* "")
385abae
@@ -489,7 +486,7 @@ Cannot compile ~a.~%"
385abae
     (setq na  (namestring
385abae
 	       (make-pathname :name name :type (pathname-type(first args)))))
385abae
    #+(or dos winnt)
385abae
-      (format nil "~a -I~a ~a ~a -c -w ~s -o ~s"
385abae
+      (format nil "~a -I~a ~a ~a -c -w ~a -o ~a"
385abae
 	      *cc*
385abae
 	      (concatenate 'string si::*system-directory* "../h")
385abae
 	      (if (and (boundp '*c-debug*) *c-debug*) " -g " "")
385abae
@@ -502,7 +499,7 @@ Cannot compile ~a.~%"
385abae
 	      )
385abae
 
385abae
    #-(or dos winnt)
385abae
-   (format nil  "~a -I~a ~a ~a -c ~s -o ~s ~a"
385abae
+   (format nil  "~a -I~a ~a ~a -c ~a -o ~a ~a"
385abae
 	   *cc*
385abae
 	   (concatenate 'string si::*system-directory* "../h")
385abae
 	   (if (and (boundp '*c-debug*) *c-debug*) " -g " "")
385abae
--- gcl-2.6.12.orig/h/elf32_mips_reloc_special.h
385abae
+++ gcl-2.6.12/h/elf32_mips_reloc_special.h
385abae
@@ -147,3 +147,6 @@ label_got_symbols(void *v1,Shdr *sec1,Sh
385abae
 	  (*(a_))->address=p->st_value;					\
385abae
 	  break;							\
385abae
 	}}})
385abae
+
385abae
+#undef LOAD_SYM_BY_NAME
385abae
+#define LOAD_SYM_BY_NAME(sym,st1) (!strncmp(st1+sym->st_name,"__moddi3",8))
385abae
--- gcl-2.6.12.orig/h/notcomp.h
385abae
+++ gcl-2.6.12/h/notcomp.h
385abae
@@ -361,7 +361,7 @@ extern bool writable_malloc;
385abae
 #define prof_block(x) x
385abae
 #endif
385abae
 
385abae
-#define psystem(x) prof_block(system(x))
385abae
+#define psystem(x) prof_block(vsystem(x))
385abae
 #define pfork() prof_block(fork())
385abae
 
385abae
 #include "error.h"
385abae
--- gcl-2.6.12.orig/lsp/gcl_top.lsp
385abae
+++ gcl-2.6.12/lsp/gcl_top.lsp
385abae
@@ -601,9 +601,21 @@ First directory is checked for first nam
385abae
 	     :device (pathname-device x)
385abae
 	     :directory (append (pathname-directory x) y)))))))))
385abae
 
385abae
+(defun get-path (s &aux (m (string-match "([^/ ]*)( |$)" s))(b (match-beginning 1))(e (match-end 1))
385abae
+		   (r (with-open-file (s (concatenate 'string "|which " (subseq s b e))) (read s nil 'eof))))
385abae
+  (if (eq r 'eof) s (concatenate 'string (string-downcase r) (subseq s e))))
385abae
+
385abae
+
385abae
+(defvar *cc* "cc")
385abae
+(defvar *ld* "ld")
385abae
+(defvar *objdump* "objdump --source ")
385abae
+
385abae
 (defun set-up-top-level (&aux (i (argc)) tem)
385abae
   (declare (fixnum i))
385abae
-  (setq *tmp-dir* (get-temp-dir))
385abae
+  (setq *tmp-dir* (get-temp-dir)
385abae
+	*cc* (get-path *cc*)
385abae
+	*ld* (get-path *ld*)
385abae
+	*objdump* (get-path *objdump*))
385abae
   (dotimes (j i) (push (argv j) tem))
385abae
   (setq *command-args* (nreverse tem))
385abae
   (setq tem *lib-directory*)
385abae
--- gcl-2.6.12.orig/o/file.d
385abae
+++ gcl-2.6.12/o/file.d
385abae
@@ -613,7 +613,8 @@ BEGIN:
385abae
 		else 
385abae
 		  fclose(strm->sm.sm_fp);
385abae
 		strm->sm.sm_fp = NULL;
385abae
-		if (type_of(strm->sm.sm_object0 ) == t_cons &&
385abae
+		if (strm->sm.sm_object0 &&
385abae
+		    type_of(strm->sm.sm_object0 ) == t_cons &&
385abae
 		    Mcar(strm->sm.sm_object0 ) == sSAallow_gzipped_fileA)
385abae
 		  fLdelete_file(Mcdr(strm->sm.sm_object0));
385abae
 		break;
385abae
--- gcl-2.6.12.orig/o/run_process.c
385abae
+++ gcl-2.6.12/o/run_process.c
385abae
@@ -502,6 +502,7 @@ make_socket_pair()
385abae
   stream_in->sm.sm_buffer = 0;
385abae
   stream_in->sm.sm_int0 = sockets_in[1];
385abae
   stream_in->sm.sm_int1 = 0;
385abae
+  stream_in->sm.sm_object0=stream_in->sm.sm_object1=OBJNULL;
385abae
   stream_out = (object) alloc_object(t_stream);
385abae
   stream_out->sm.sm_mode = smm_output;
385abae
   stream_out->sm.sm_fp = fp2;
385abae
@@ -510,6 +511,7 @@ make_socket_pair()
385abae
   setup_stream_buffer(stream_out);
385abae
   stream_out->sm.sm_int0 = sockets_out[1];
385abae
   stream_out->sm.sm_int1 = 0;
385abae
+  stream_out->sm.sm_object0=stream_out->sm.sm_object1=OBJNULL;
385abae
   stream = make_two_way_stream(stream_in, stream_out);
385abae
   return(stream);
385abae
 }
385abae
--- gcl-2.6.12.orig/o/sfaslelf.c
385abae
+++ gcl-2.6.12/o/sfaslelf.c
385abae
@@ -54,9 +54,10 @@ License for more details.
385abae
 
385abae
 #define ulmax(a_,b_) ({ul _a=a_,_b=b_;_a<_b ? _b : _a;})
385abae
 #define ALLOC_SEC(sec) (sec->sh_flags&SHF_ALLOC && (sec->sh_type==SHT_PROGBITS || sec->sh_type==SHT_NOBITS))
385abae
-#define  LOAD_SEC(sec) (sec->sh_flags&SHF_ALLOC &&  sec->sh_type==SHT_PROGBITS)
385abae
-#define  LOAD_SYM(sym) ({ul _b=ELF_ST_BIND(sym->st_info),_t=ELF_ST_TYPE(sym->st_info);	\
385abae
-      sym->st_value && (_b==STB_GLOBAL || _b==STB_WEAK || (_t>=STT_LOPROC && _t<=STT_HIPROC));})
385abae
+#define LOAD_SEC(sec) (sec->sh_flags&SHF_ALLOC &&  sec->sh_type==SHT_PROGBITS)
385abae
+#define LOAD_SYM_BY_BIND(sym) ({ul _b=ELF_ST_BIND(sym->st_info); sym->st_value && (_b==STB_GLOBAL || _b==STB_WEAK);})
385abae
+#define LOAD_SYM_BY_NAME(sym,st1) 0
385abae
+#define LOAD_SYM(sym,st1) (LOAD_SYM_BY_BIND(sym)||LOAD_SYM_BY_NAME(sym,st1))
385abae
 
385abae
 #define MASK(n) (~(~0ULL << (n)))
385abae
 
385abae
@@ -410,7 +411,7 @@ calc_space(ul *ns,ul *sl,Sym *sym1,Sym *
385abae
 
385abae
   for (sym=sym1;sym
385abae
     
385abae
-    if (!LOAD_SYM(sym))
385abae
+    if (!LOAD_SYM(sym,st1))
385abae
       continue;
385abae
 
385abae
     if (d1) {
385abae
@@ -436,7 +437,7 @@ load_ptable(struct node **a,char **s,Sym
385abae
 
385abae
   for (sym=sym1;sym
385abae
 
385abae
-    if (!LOAD_SYM(sym))
385abae
+    if (!LOAD_SYM(sym,st1))
385abae
       continue;
385abae
 
385abae
     if (d1) {
385abae
--- gcl-2.6.12.orig/o/unixsys.c
385abae
+++ gcl-2.6.12/o/unixsys.c
385abae
@@ -24,10 +24,38 @@ Foundation, 675 Mass Ave, Cambridge, MA
385abae
 #include <string.h>
385abae
 #include <sys/stat.h>
385abae
 #include <sys/types.h>
385abae
-
385abae
+#include <sys/wait.h>
385abae
 
385abae
 #include "include.h"
385abae
 
385abae
+int
385abae
+vsystem(const char *command) {
385abae
+
385abae
+  unsigned j,n=strlen(command);
385abae
+  char *z=alloca(n+1),**p1,**pp,*c;
385abae
+  int s;
385abae
+  pid_t pid;
385abae
+
385abae
+  memcpy(z,command,n+1);
385abae
+  for (j=0,c=z;strtok(c," \n\t");c=NULL,j++);
385abae
+
385abae
+  memcpy(z,command,n+1);
385abae
+  p1=alloca((j+1)*sizeof(*p1));
385abae
+  for (pp=p1,c=z;(*pp=strtok(c," \n\t"));c=NULL,pp++);
385abae
+
385abae
+  if (!(pid=vfork())) {
385abae
+    execvp(*p1,p1);
385abae
+    _exit(2);
385abae
+  }
385abae
+
385abae
+  massert(pid>0);
385abae
+  massert(pid==waitpid(pid,&s,0));
385abae
+
385abae
+  return s;
385abae
+
385abae
+}
385abae
+
385abae
+
385abae
 #ifdef ATT3B2
385abae
 #include <signal.h>
385abae
 int