Blob Blame History Raw
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.12-93) unstable; urgency=medium
 .
   * Version_2_6_13pre90
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: https://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: 2020-02-21

--- gcl-2.6.12.orig/configure
+++ gcl-2.6.12/configure
@@ -3974,7 +3974,7 @@ $as_echo "removing $1 from LDFLAGS" >&6;
 
 }
 
-add_args_to_cflags -fsigned-char -pipe \
+add_args_to_cflags -fsigned-char -pipe -fcommon \
                     -fno-builtin-malloc -fno-builtin-free \
                     -fno-PIE -fno-pie -fno-PIC -fno-pic \
 	            -Wall \
--- gcl-2.6.12.orig/configure.in
+++ gcl-2.6.12/configure.in
@@ -258,7 +258,7 @@ remove_arg_from_ldflags() {
     
 }
 
-add_args_to_cflags -fsigned-char -pipe \
+add_args_to_cflags -fsigned-char -pipe -fcommon \
                     -fno-builtin-malloc -fno-builtin-free \
                     -fno-PIE -fno-pie -fno-PIC -fno-pic \
 	            -Wall \
--- gcl-2.6.12.orig/o/main.c
+++ gcl-2.6.12/o/main.c
@@ -445,20 +445,21 @@ gcl_cleanup(int gc) {
 }
 
 /*gcc boolean expression tail position bug*/
+static char *stack_to_be_allocated;
 
-void *
-cclear_stack(unsigned long size) {
-  void *v=alloca(size);
-  memset(v,0,size);
-  return v;
+void
+get_stack_to_be_allocated(unsigned long size) {
+  stack_to_be_allocated=alloca(size);
 }
 
 DEFUN_NEW("EQUAL-TAIL-RECURSION-CHECK",object,fSequal_tail_recursion_check,SI,1,1,NONE,II,OO,OO,OO,(fixnum s),"") {
   object x0=make_list(s/sizeof(object)),x1=make_list(s/sizeof(object));
-  char *u=cclear_stack(s),*w;
+  char *w;
+  get_stack_to_be_allocated(s);
+  memset(stack_to_be_allocated,0,s);
   fLequal(x0,x1);
-  for (w=u;w<u+s && !*w;w++);
-  RETURN1((object)(w-u));
+  for (w=stack_to_be_allocated;w<stack_to_be_allocated+s && !*w;w++);
+  RETURN1((object)(w-stack_to_be_allocated));
 }
 
 static int
--- gcl-2.6.12.orig/o/unixfsys.c
+++ gcl-2.6.12/o/unixfsys.c
@@ -537,7 +537,7 @@ un_mmap(void *v1,void *ve) {
 /* 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);}
-char *gcl_strncpy_chk(size_t z) {char a[10],b[10];return strncpy(a,b,z);}/*compile in __strncpy_chk with FORTIFY_SOURCE*/
+int gcl_strncpy_chk(char *a1,char *b1,size_t z) {char a[10],b[10];strncpy(a,a1,z);strncpy(b,b1,z);return strncmp(a,b,z);}/*compile in __strncpy_chk with FORTIFY_SOURCE*/
 #ifdef __MINGW32__
 #define uid_t int
 #endif