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.10-34) unstable; urgency=medium
 .
   * --enable-prelink configure arg; stack_chk_guard for 68k
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.10.orig/o/gbc.c
+++ gcl-2.6.10/o/gbc.c
@@ -249,7 +249,6 @@ bool ovm_process_created;
 #endif
 
 
-bool saving_system;
 static int gc_time = -1;
 static int gc_start = 0;
 static int gc_recursive = 0;
@@ -1368,7 +1367,7 @@ GBC(enum type t) {
     
     if (rb_start < rb_start1) {
       j = (rb_pointer-rb_start + PAGESIZE - 1)/PAGESIZE;
-      memcpy(rb_start,rb_start1,j*PAGESIZE);
+      memmove(rb_start,rb_start1,j*PAGESIZE);
     }
     
 #ifdef SGC
@@ -1573,7 +1572,7 @@ copy_relblock(char *p, int s)
  rb_pointer += s;
  rb_pointer1 += s;
  
- memcpy(q,p,s);
+ memmove(q,p,s);
  /* while (--s >= 0) */
  /*   { *q++ = *p++;} */
  
--- gcl-2.6.10.orig/o/main.c
+++ gcl-2.6.10/o/main.c
@@ -50,7 +50,7 @@ void initialize_process();
 #include <signal.h>
 #include "page.h"
 
-bool saving_system ;
+bool saving_system=FALSE;
 
 #ifdef BSD
 #include <sys/time.h>
@@ -319,7 +319,6 @@ main(int argc, char **argv, char **envp)
     
   } else {
 
-    saving_system = FALSE;
     terminal_io->sm.sm_object0->sm.sm_fp = stdin;
     terminal_io->sm.sm_object1->sm.sm_fp = stdout;
 #ifdef LD_BIND_NOW /*FIXME currently mips only, verify that these two requirements are the same*/
@@ -864,8 +863,9 @@ FFN(siLsave_system)(void) {
 
   minimize_image();
 
-  Lsave();
   saving_system = FALSE;
+
+  Lsave();
   alloc_page(-(holepage+nrbpage));
 
 }
--- gcl-2.6.10.orig/o/sfasl.c
+++ gcl-2.6.10/o/sfasl.c
@@ -60,6 +60,21 @@ find_sym_ptable(const char *name) {
 
 }
 
+DEFUN_NEW("FIND-SYM-PTABLE",object,fSfind_sym_ptable,SI,1,1,NONE,IO,OO,OO,OO,(object x),"") {
+  char c;
+  struct node *a;
+
+  check_type_string(&x);
+
+  c=x->st.st_self[x->st.st_fillp];
+  x->st.st_self[x->st.st_fillp]=0;
+  a=find_sym_ptable(x->st.st_self);
+  x->st.st_self[x->st.st_fillp]=c;
+
+  return (object)(a ? a->address : 0);
+
+}
+
 #endif
 
 #ifdef SEPARATE_SFASL_FILE
--- gcl-2.6.10.orig/o/sfaslelf.c
+++ gcl-2.6.10/o/sfaslelf.c
@@ -230,6 +230,9 @@ relocate_symbols(Sym *sym,Sym *syme,Shdr
 
     else if ((a=find_sym_ptable(st1+sym->st_name)))
       sym->st_value=a->address;
+
+    else if (ELF_ST_BIND(sym->st_info)!=STB_LOCAL)
+      massert(!fprintf(stderr,"Unrelocated non-local symbol: %s\n",st1+sym->st_name));
 	
   }
 
--- gcl-2.6.10.orig/o/unixfsys.c
+++ gcl-2.6.10/o/unixfsys.c
@@ -468,7 +468,15 @@ DEF_ORDINARY("DIRECTORY",sKdirectory,KEY
 DEF_ORDINARY("LINK",sKlink,KEYWORD,"");
 DEF_ORDINARY("FILE",sKfile,KEYWORD,"");
 
-/* extern char *ctime_r(const time_t *,char *); */
+/* export these for AXIOM */
+int gcl_putenv(char *s) {return putenv(s);}
+char *gcl_strncpy(char *d,const char *s,size_t z) {return strncpy(d,s,z);}
+uid_t gcl_geteuid(void) {return geteuid();}
+uid_t gcl_getegid(void) {return getegid();}
+int gcl_dup2(int o,int n) {return dup2(o,n);}
+char *gcl_gets(char *s,int z) {return fgets(s,z,stdin);}
+int gcl_fputs(const char *s) {int i=fputs(s,stdout);fflush(stdout);return i;}
+
 
 DEFUN_NEW("STAT",object,fSstat,SI,1,1,NONE,OO,OO,OO,OO,(object path),"") {
 
