<short summary of the patch>
authorCamm Maguire <camm@debian.org>
Thu, 11 Aug 2022 17:16:42 +0000 (18:16 +0100)
committerCamm Maguire <camm@debian.org>
Thu, 11 Aug 2022 17:16:42 +0000 (18:16 +0100)
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-85) unstable; urgency=medium

  * Version_2_6_13pre82

Gbp-Pq: Name Version_2_6_13pre83

configure
configure.in
h/unrandomize.h

index 89e3f711da0bece91a412c19d8c65ef09f046781..de47db8446b68355f35ce499318f1014f3f4febf 100755 (executable)
--- a/configure
+++ b/configure
@@ -6375,7 +6375,7 @@ main ()
                FILE *f;
                if (!(f=fopen("conftest1","w")))
                   return -1;
-                  fprintf(f,"%u",sbrk(0));
+                  fprintf(f,"%p",sbrk(0));
 
   ;
   return 0;
@@ -6591,7 +6591,7 @@ else
                        #endif
                        if (!(f=fopen("conftest1","w")))
                           return -1;
-                          fprintf(f,"%u",sbrk(0));
+                          fprintf(f,"%p",sbrk(0));
                           return 0;
                    }
 
@@ -6625,7 +6625,7 @@ else
                        #include "h/unrandomize.h"
                        #endif
                        if (!(f=fopen("conftest1","w"))) return -1;
-                          fprintf(f,"%u",sbrk(0));
+                          fprintf(f,"%p",sbrk(0));
                           return 0;
                    }
 
@@ -6653,8 +6653,9 @@ $as_echo "no" >&6; }
        as_fn_error $? "exiting" "$LINENO" 5
     fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CSTACK_ADDRESS" >&5
-$as_echo_n "checking CSTACK_ADDRESS... " >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CSTACK_DIRECTION" >&5
+$as_echo_n "checking CSTACK_DIRECTION... " >&6; }
 if test "$cross_compiling" = yes; then :
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -6666,12 +6667,59 @@ else
 
                #include <stdio.h>
                #include <stdlib.h>
-               void *
-               foo() {
+
+               unsigned long w;
+
+               void
+               foo(void) {
                    int i;
-                   return (void *)&i;
+                   w=(unsigned long)&i;
+               }
+
+               int
+               main(int argc,char **argv,char **envp) {
+                   void *b;
+                   FILE *fp = fopen("conftest1","w");
+                   #ifdef CAN_UNRANDOMIZE_SBRK
+                   #include "h/unrandomize.h"
+                   #endif
+                   foo();
+                   fprintf(fp,"%d",((unsigned long) &b) > w ? -1 : 1);
+                   fclose(fp);
+                   return 0;
                }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  cstack_direction=`cat conftest1`
+else
+  cstack_direction=0
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define CSTACK_DIRECTION $cstack_direction
+_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cstack_direction" >&5
+$as_echo "$cstack_direction" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CSTACK_ADDRESS" >&5
+$as_echo_n "checking CSTACK_ADDRESS... " >&6; }
+if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+               #include <stdio.h>
+               #include <stdlib.h>
                int
                main(int argc,char **argv,char **envp) {
                    void *v ;
@@ -6685,13 +6733,13 @@ else
                    j<<=$PAGEWIDTH;
                    j<<=16;
                    i=(unsigned long)&v;
-                   if (foo()>i) i-=j;
-                      j--;
-                      i+=j;
-                      i&=~j;
-                      fprintf(fp,"0x%lx",i-1);
-                      fclose(fp);
-                      return 0;
+                   if ($cstack_direction==1) i-=j;
+                   j--;
+                   i+=j;
+                   i&=~j;
+                   fprintf(fp,"0x%lx",i-1);
+                   fclose(fp);
+                   return 0;
                }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
@@ -6724,12 +6772,6 @@ else
 
                #include <stdio.h>
                #include <stdlib.h>
-               void *
-               foo() {
-                   int i;
-                   return (void *)&i;
-               }
-
                int
                main(int argc,char **argv,char **envp) {
                    void *v ;
@@ -6743,14 +6785,14 @@ else
                    j<<=$PAGEWIDTH;
                    j<<=16;
                    i=(unsigned long)&v;
-                   if (foo()>i) i-=j;
-                      j--;
-                      i+=j;
-                      i&=~j;
-                      for (j=0;(i>>j)!=(i>>(sizeof(long)*8-1));j++);
-                          fprintf(fp,"%d",j);
-                          fclose(fp);
-                          return 0;
+                   if ($cstack_direction==1) i-=j;
+                   j--;
+                   i+=j;
+                   i&=~j;
+                   for (j=0;(i>>j)!=(i>>(sizeof(long)*8-1));j++);
+                   fprintf(fp,"%ld",j);
+                   fclose(fp);
+                   return 0;
                }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
@@ -6854,54 +6896,6 @@ _ACEOF
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cstack_alignment" >&5
 $as_echo "$cstack_alignment" >&6; }
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CSTACK_DIRECTION" >&5
-$as_echo_n "checking CSTACK_DIRECTION... " >&6; }
-if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-               #include <stdio.h>
-               #include <stdlib.h>
-               void *
-               foo(void) {
-                   int i;
-                   return (void *)&i;
-               }
-
-               int
-               main(int argc,char **argv,char **envp) {
-                   char *b;
-                   FILE *fp = fopen("conftest1","w");
-                   #ifdef CAN_UNRANDOMIZE_SBRK
-                   #include "h/unrandomize.h"
-                   #endif
-                   fprintf(fp,"%d",((long) &b) > ((long) foo()) ? -1 : 1);
-                   fclose(fp);
-                   return 0;
-               }
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  cstack_direction=`cat conftest1`
-else
-  cstack_direction=0
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define CSTACK_DIRECTION $cstack_direction
-_ACEOF
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cstack_direction" >&5
-$as_echo "$cstack_direction" >&6; }
-
 # Check whether --enable-immfix was given.
 if test "${enable_immfix+set}" = set; then :
   enableval=$enable_immfix;
@@ -7050,8 +7044,7 @@ int
 main ()
 {
 
-               void *v;
-               unsigned long i,j,k,l,m;
+               unsigned long i,j,k,l;
                FILE *fp = fopen("conftest1","w");
 
                for (i=2,k=1;i;k=i,i<<=1);
index 1d32735f07d23954bfbfaef79952884057a574fd..fddf85ac64b0d44086ced696e4ed7a96305bad4d 100644 (file)
@@ -1049,7 +1049,7 @@ AC_RUN_IFELSE(
                FILE *f;
                if (!(f=fopen("conftest1","w")))
                   return -1;
-                  fprintf(f,"%u",sbrk(0));
+                  fprintf(f,"%p",sbrk(0));
            ]])],
     [HAVE_SBRK=1;AC_MSG_RESULT([yes])],
     AC_MSG_RESULT([no: WARNING you must be able to emulate sbrk: as on mingw or macosx]),
@@ -1145,7 +1145,7 @@ if test "$HAVE_SBRK" = "1" ; then
                        #endif
                        if (!(f=fopen("conftest1","w")))
                           return -1;
-                          fprintf(f,"%u",sbrk(0));
+                          fprintf(f,"%p",sbrk(0));
                           return 0;
                    }
                ]])],[SBRK=`cat conftest1`])
@@ -1165,7 +1165,7 @@ if test "$HAVE_SBRK" = "1" ; then
                        #include "h/unrandomize.h"
                        #endif
                        if (!(f=fopen("conftest1","w"))) return -1;
-                          fprintf(f,"%u",sbrk(0));
+                          fprintf(f,"%p",sbrk(0));
                           return 0;
                    }
                ]])],[SBRK1=`cat conftest1`])
@@ -1183,18 +1183,45 @@ if test "$HAVE_SBRK" = "1" ; then
        AC_MSG_ERROR([exiting])
     fi
 fi
-AC_MSG_CHECKING(CSTACK_ADDRESS)
+
+AC_MSG_CHECKING(CSTACK_DIRECTION)
 AC_RUN_IFELSE(
     [AC_LANG_SOURCE(
            [[
                #include <stdio.h>
                #include <stdlib.h>
-               void *
-               foo() {
+
+               unsigned long w;
+
+               void
+               foo(void) {
                    int i;
-                   return (void *)&i;
+                   w=(unsigned long)&i;
                }
                
+               int
+               main(int argc,char **argv,char **envp) {
+                   void *b;
+                   FILE *fp = fopen("conftest1","w");
+                   #ifdef CAN_UNRANDOMIZE_SBRK
+                   #include "h/unrandomize.h"
+                   #endif
+                   foo();
+                   fprintf(fp,"%d",((unsigned long) &b) > w ? -1 : 1);
+                   fclose(fp);
+                   return 0;
+               }]])],
+    [cstack_direction=`cat conftest1`],[cstack_direction=0])
+AC_DEFINE_UNQUOTED(CSTACK_DIRECTION,$cstack_direction,[whether C stack grows up or down])
+AC_MSG_RESULT($cstack_direction)
+
+
+AC_MSG_CHECKING(CSTACK_ADDRESS)
+AC_RUN_IFELSE(
+    [AC_LANG_SOURCE(
+           [[
+               #include <stdio.h>
+               #include <stdlib.h>
                int
                main(int argc,char **argv,char **envp) {
                    void *v ;
@@ -1208,13 +1235,13 @@ AC_RUN_IFELSE(
                    j<<=$PAGEWIDTH;
                    j<<=16;
                    i=(unsigned long)&v;
-                   if (foo()>i) i-=j;
-                      j--;
-                      i+=j;
-                      i&=~j;
-                      fprintf(fp,"0x%lx",i-1);
-                      fclose(fp);
-                      return 0;
+                   if ($cstack_direction==1) i-=j;
+                   j--;
+                   i+=j;
+                   i&=~j;
+                   fprintf(fp,"0x%lx",i-1);
+                   fclose(fp);
+                   return 0;
                }]])],
     [cstack_address=`cat conftest1`],[cstack_address=0])
 AC_DEFINE_UNQUOTED(CSTACK_ADDRESS,$cstack_address,[starting C stack address])
@@ -1226,12 +1253,6 @@ AC_RUN_IFELSE(
            [[
                #include <stdio.h>
                #include <stdlib.h>
-               void *
-               foo() {
-                   int i;
-                   return (void *)&i;
-               }
-               
                int
                main(int argc,char **argv,char **envp) {
                    void *v ;
@@ -1245,14 +1266,14 @@ AC_RUN_IFELSE(
                    j<<=$PAGEWIDTH;
                    j<<=16;
                    i=(unsigned long)&v;
-                   if (foo()>i) i-=j;
-                      j--;
-                      i+=j;
-                      i&=~j;
-                      for (j=0;(i>>j)!=(i>>(sizeof(long)*8-1));j++);
-                          fprintf(fp,"%d",j);
-                          fclose(fp);
-                          return 0;
+                   if ($cstack_direction==1) i-=j;
+                   j--;
+                   i+=j;
+                   i&=~j;
+                   for (j=0;(i>>j)!=(i>>(sizeof(long)*8-1));j++);
+                   fprintf(fp,"%ld",j);
+                   fclose(fp);
+                   return 0;
                }]])],
     [cstack_bits=`cat conftest1`],[cstack_bits=0])
 AC_DEFINE_UNQUOTED(CSTACK_BITS,$cstack_bits,[log starting C stack address])
@@ -1302,33 +1323,6 @@ AC_RUN_IFELSE(
 AC_DEFINE_UNQUOTED(CSTACK_ALIGNMENT,$cstack_alignment,[C stack alignment])
 AC_MSG_RESULT($cstack_alignment)
 
-AC_MSG_CHECKING(CSTACK_DIRECTION)
-AC_RUN_IFELSE(
-    [AC_LANG_SOURCE(
-           [[
-               #include <stdio.h>
-               #include <stdlib.h>
-               void *
-               foo(void) {
-                   int i;
-                   return (void *)&i;
-               }
-               
-               int
-               main(int argc,char **argv,char **envp) {
-                   char *b;
-                   FILE *fp = fopen("conftest1","w");
-                   #ifdef CAN_UNRANDOMIZE_SBRK
-                   #include "h/unrandomize.h"
-                   #endif
-                   fprintf(fp,"%d",((long) &b) > ((long) foo()) ? -1 : 1);
-                   fclose(fp);
-                   return 0;
-               }]])],
-    [cstack_direction=`cat conftest1`],[cstack_direction=0])
-AC_DEFINE_UNQUOTED(CSTACK_DIRECTION,$cstack_direction,[whether C stack grows up or down])
-AC_MSG_RESULT($cstack_direction)
-
 AC_ARG_ENABLE([immfix],[  --enable-immfix will enable an immediate fixnum table above the C stack])
 
 AC_ARG_ENABLE([fastimmfix],[  --enable-fastimmfix=XXXX will reject low immediate fixnums unless 2^XXX can be attained],,[enable_fastimmfix=64])
@@ -1429,8 +1423,7 @@ AC_RUN_IFELSE(
                #include <stdio.h>
            ]],
            [[
-               void *v;
-               unsigned long i,j,k,l,m;
+               unsigned long i,j,k,l;
                FILE *fp = fopen("conftest1","w");
                
                for (i=2,k=1;i;k=i,i<<=1);
index 74cc659f44d9c04b97606b809c5201e93411348f..a11374b38b47a6bc8f2193264787b4cdfcee3311 100644 (file)
@@ -14,7 +14,7 @@
     long pers = personality(READ_IMPLIES_EXEC|personality(0xffffffffUL));
     long flag = ADDR_NO_RANDOMIZE;
 
-    if (sizeof(long)==4) flag|=ADDR_LIMIT_3GB|ADDR_COMPAT_LAYOUT;
+    if (sizeof(long)==4) flag|=ADDR_LIMIT_3GB/* |ADDR_COMPAT_LAYOUT */;
 
     if (pers==-1) {printf("personality failure %d\n",errno);exit(-1);}
     if ((pers & flag)!=flag && !getenv("GCL_UNRANDOMIZE")) {