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-12) unstable; urgency=low
 .
   * ia64/hurd/s390
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
@@ -6718,60 +6718,6 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking TYPE_BITS macro" >&5
-$as_echo_n "checking TYPE_BITS macro... " >&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>
-	#define EXTER
-	#include "$MP_INCLUDE"
-	#include "./h/enum.h"
-	#include "./h/bits.h"
-	#include "./h/object.h"
-
-
-int
-main ()
-{
-
-
-	FILE *f=fopen("conftest1","w");
-	union lispunion g={.fw=0};
-	g.d.e=-1;
-	g.d.t=-1;
-	g.d.s=-1;
-	fprintf(f,"0x%x",g.fw);
-	fclose(f);
-	return 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  type_bits=`cat conftest1`
-else
-  as_fn_error $? "Cannot find type_bits" "$LINENO" 5
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $type_bits" >&5
-$as_echo "$type_bits" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define TYPE_BITS $type_bits
-_ACEOF
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sizeof struct contblock" >&5
 $as_echo_n "checking sizeof struct contblock... " >&6; }
 
@@ -7111,7 +7057,7 @@ else
   fprintf ( fp,"0x%lx", 0x3000000 );  /* Windows custom allocation from this point up */
   #else
   #if defined (__APPLE__) && defined (__MACH__)
-  fprintf(fp,"((unsigned long)get_dbegin())");
+  fprintf(fp,"0x0");
   #else
   b = sbrk(0);
   fprintf(fp,"0x%lx",((unsigned long) b) & ~(unsigned long)((1<<PAGEWIDTH)-1));
@@ -7385,18 +7331,22 @@ else
 if test "$enable_static" = "yes" ; then
   heap_ceiling=0x0
 else
-if ! test -x `which ldd` && ! test -d /proc/self ; then
+if ! test -x `which ldd` && ! test -f /proc/self/maps ; then
    heap_ceiling=0x0
 else
-if test -d /proc/self ; then
+if test -f /proc/self/maps ; then
    heap_ceiling=0x`/bin/cat /proc/self/maps | grep "/lib.*/ld-" | cut -f1 -d- | head -1`
 else
+if test "`which ldd`" = "" ; then
+   heap_ceiling=0x0
+else
 #echo -e "#include <stdio.h>\n int main() {printf(\"foo\");return 0;}" >foo.c
 #$CC foo.c -o foo
    AAWK=`which awk`
 # | grep -v ld-kfreebsd needed on some strange bsd amd64 boxes
    heap_ceiling=`ldd $AAWK | tail -n 1 | $AWK '{print $NF}' | tr -d '()'`
 fi
+fi
 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;}
--- gcl-2.6.7+dfsga.orig/configure.in
+++ gcl-2.6.7+dfsga/configure.in
@@ -1132,30 +1132,6 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[
 AC_MSG_RESULT($obj_align)
 AC_DEFINE_UNQUOTED(OBJ_ALIGN,$obj_align,[can use C extension for object alignment])
 
-AC_MSG_CHECKING(TYPE_BITS macro)
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-        #include <stdio.h>
-	#define EXTER
-	#include "$MP_INCLUDE"
-	#include "./h/enum.h"
-	#include "./h/bits.h"
-	#include "./h/object.h"
-
-	]],[[
-
-	FILE *f=fopen("conftest1","w");
-	union lispunion g={.fw=0};
-	g.d.e=-1;
-	g.d.t=-1;
-	g.d.s=-1;
-	fprintf(f,"0x%x",g.fw);
-	fclose(f);
-	return 0;
-	]])],[type_bits=`cat conftest1`],
-        [AC_MSG_ERROR([Cannot find type_bits])])
-AC_MSG_RESULT($type_bits)
-AC_DEFINE_UNQUOTED(TYPE_BITS,$type_bits,[bit mask for type flags in objects])
-
 AC_MSG_CHECKING(sizeof struct contblock)
 
 # work around MSYS pwd result incompatibility
@@ -1437,10 +1413,10 @@ else
 if test "$enable_static" = "yes" ; then
   heap_ceiling=0x0
 else
-if ! test -x `which ldd` && ! test -d /proc/self ; then
+if ! test -x `which ldd` && ! test -f /proc/self/maps ; then
    heap_ceiling=0x0
 else
-if test -d /proc/self ; then
+if test -f /proc/self/maps ; then
    heap_ceiling=0x`/bin/cat /proc/self/maps | grep "/lib.*/ld-" | cut -f1 -d- | head -1`
 else 
 if test "`which ldd`" = "" ; then 
--- gcl-2.6.7+dfsga.orig/h/object.h
+++ gcl-2.6.7+dfsga/h/object.h
@@ -163,7 +163,7 @@ struct fixnum_struct {
 #define mark(a_)                 if (is_imm_fixnum(Zcdr(a_))) mark_imm_fixnum(Zcdr(a_)); else (a_)->d.m=1
 #define unmark(a_)               if (is_imm_fixnum(Zcdr(a_))) unmark_imm_fixnum(Zcdr(a_)); else (a_)->d.m=0
 #define is_free(a_)              (!is_imm_fixnum(a_) && !is_imm_fixnum(Zcdr(a_)) && (a_)->d.f)
-#define make_free(a_)            {(a_)->fw&=TYPE_BITS;(a_)->d.f=1;}/*set_type_of(a_,t_other)*/
+#define make_free(a_)            {(a_)->fw=0;(a_)->d.f=1;}/*set_type_of(a_,t_other)*/
 #define make_unfree(a_)          {(a_)->d.f=0;}
 
 #define valid_cdr(a_)            (!(a_)->d.e || is_imm_fixnum(Zcdr(a_)))
@@ -177,7 +177,7 @@ struct fixnum_struct {
 /* #define type_of(x)       ({register object _z=(object)(x);\ */
 /*       _z==Cnil ? t_symbol : is_imm_fixnum(_z) ? t_fixnum : _z->d.t;}) */
   
-#define set_type_of(x,y) ({object _x=(object)(x);enum type _y=(y);_x->fw&=TYPE_BITS;if (_y!=t_cons) {_x->d.e=1;_x->d.t=_y;}})
+#define set_type_of(x,y) ({object _x=(object)(x);enum type _y=(y);_x->fw=0;if (_y!=t_cons) {_x->d.e=1;_x->d.t=_y;}})
 
 /* ({register object _z=(object)(x);			   \ */
 /*   _z==Cnil ? t_symbol :					   \ */
--- gcl-2.6.7+dfsga.orig/h/notcomp.h
+++ gcl-2.6.7+dfsga/h/notcomp.h
@@ -249,16 +249,7 @@ EXTER struct printStruct *printStructBuf
 */
 #ifndef NULL_OR_ON_C_STACK
 
-
-#if (CSTACK_ADDRESS > 0)
-#if (CSTACK_DIRECTION == -1)
-#define NULL_OR_ON_C_STACK(x) ((x)==0 || ((unsigned long)x) > (unsigned long)cs_limit)
-#else
-#define NULL_OR_ON_C_STACK(x) ((x)==0 || ((unsigned long)x) > (unsigned long)cs_org)
-#endif
-#else
-#define NULL_OR_ON_C_STACK(x) ((long)x <= 0)     
-#endif
+#define NULL_OR_ON_C_STACK(x) (((void *)(x))<=(void *)DBEGIN || ((void *)(x))>=(void *)core_end)
 
 #endif /* NULL_OR_ON_C_STACK */
 
--- gcl-2.6.7+dfsga.orig/h/386-gnu.h
+++ gcl-2.6.7+dfsga/h/386-gnu.h
@@ -67,7 +67,7 @@
 #ifndef SA_NOCLDWAIT
 #define SA_NOCLDWAIT 0 /*fixme handler does waitpid(-1, ..., WNOHANG)*/
 #endif
-#define NULL_OR_ON_C_STACK(x) ((unsigned long)x <= DBEGIN)/*fixme configure detect*/
+/* #define NULL_OR_ON_C_STACK(x) ((unsigned long)x <= DBEGIN)/\*fixme configure detect*\/ */
 #define PATH_MAX 4096 /*fixme dynamic*/
 #define MAXPATHLEN 4096 /*fixme dynamic*/
 
--- gcl-2.6.7+dfsga.orig/h/gclincl.h.in
+++ gcl-2.6.7+dfsga/h/gclincl.h.in
@@ -317,9 +317,6 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
-/* bit mask for type flags in objects */
-#undef TYPE_BITS
-
 /* have _cleanup function */
 #undef USE_CLEANUP
 
--- gcl-2.6.7+dfsga.orig/h/page.h
+++ gcl-2.6.7+dfsga/h/page.h
@@ -121,3 +121,6 @@ extern fixnum writable_pages;
 #if !defined(IN_MAIN) && defined(SGC)
 #include "writable.h"
 #endif
+
+EXTER unsigned long first_data_page;
+
--- gcl-2.6.7+dfsga.orig/o/alloc.c
+++ gcl-2.6.7+dfsga/o/alloc.c
@@ -1034,8 +1034,6 @@ static void init_textpage() {
 }
 #endif
 
-unsigned long first_data_page=0;
-
 void
 gcl_init_alloc(void) {
 
--- gcl-2.6.7+dfsga.orig/o/main.c
+++ gcl-2.6.7+dfsga/o/main.c
@@ -133,7 +133,7 @@ update_real_maxpage(void) {
   void *end,*cur;
 
   massert(cur=sbrk(0));
-  for (i=1;i<=log_maxpage_bound;i++)
+  for (i=PAGEWIDTH;i<=log_maxpage_bound;i++)
     if ((end=(void *)(1L<<i)-PAGESIZE)>cur)
       if (!mbrk(end))
 	real_maxpage=page(end);
@@ -509,7 +509,8 @@ initlisp(void) {
              || NULL_OR_ON_C_STACK((IM_FIX_BASE|IM_FIX_LIM)) == 0
 #endif
 	    || NULL_OR_ON_C_STACK(vv) != 0
-	    || NULL_OR_ON_C_STACK(pagetoinfo(real_maxpage)))
+	    || NULL_OR_ON_C_STACK(data_start)
+	    || NULL_OR_ON_C_STACK(core_end-1))
 	  /* check person has correct definition of above */
 	  error("NULL_OR_ON_C_STACK macro invalid");
 	
--- gcl-2.6.7+dfsga.orig/o/sgbc.c
+++ gcl-2.6.7+dfsga/o/sgbc.c
@@ -1346,13 +1346,8 @@ sgc_start(void) {
   }
   /* the relblock has been allocated */
   
-  {
-
-    VFUN_NARGS=3;
-    sSAwritableA->s.s_dbind=fSmake_vector1((page(rb_start)-first_data_page),aet_bit,Cnil);
-    wrimap=(void *)sSAwritableA->s.s_dbind->v.v_self;
-  
-  }
+  sSAwritableA->s.s_dbind=fSmake_vector1_1((page(rb_start)-first_data_page),aet_bit,Cnil);
+  wrimap=(void *)sSAwritableA->s.s_dbind->v.v_self;
 
   /* now move the sgc free lists into place.   alt_free should
      contain the others */
--- gcl-2.6.7+dfsga.orig/o/num_log.c
+++ gcl-2.6.7+dfsga/o/num_log.c
@@ -247,6 +247,12 @@ L2OP(IOR,|,fS2logior,mpz_ior);
 L2OP(AND,&,fS2logand,mpz_and);
 L2OP(XOR,^,fS2logxor,mpz_xor);
 
+#ifdef STATIC_FUNCTION_POINTERS
+object fS2logior(object x,object y) { return FFN(fS2logior)(x,y);}
+object fS2logxor(object x,object y) { return FFN(fS2logxor)(x,y);}
+object fS2logand(object x,object y) { return FFN(fS2logand)(x,y);}
+#endif
+
 DEFUN_NEW("1LOGNOT",object,fS1lognot,SI,1,1,NONE,OO,OO,OO,OO,(object x),"") {
 
   object u;								
