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-33) unstable; urgency=medium
 .
   * hurd stack_guard, ppc64 C_GC_OFFSET
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/configure
+++ gcl-2.6.10/configure
@@ -624,6 +624,7 @@ use
 GNU_LD
 LEADING_UNDERSCORE
 EXTRA_LOBJS
+PRELINK_CHECK
 O2FLAGS
 O3FLAGS
 NIFLAGS
@@ -739,6 +740,7 @@ enable_option_checking
 enable_widecons
 enable_safecdr
 enable_safecdrdbg
+enable_prelink
 enable_fastimmfix
 enable_holepage
 enable_vssize
@@ -1399,6 +1401,7 @@ Optional Features:
 use a three word cons with simplified typing
 protect cdr from immfix and speed up type processing
 debug safecdr code
+--enable-prelink will insist that the produced images may be prelinked
 --enable-fastimmfix=XXXX will reject low immediate fixnums unless 1<<XXXX can be attained
  --enable-holepage=XXXX will compile in a XXX-sized hole between the heap and relocatable memory area (eg '--enable-holepage=64*1024' would give 64K pages allowing 256 MB if pages are 4K each)
  --enable-vssize=XXXX will compile in a value stack of size XXX
@@ -2529,6 +2532,14 @@ $as_echo "#define DEBUG_SAFE_CDR 1" >>co
 fi
 
 
+# Check whether --enable-prelink was given.
+if test "${enable_prelink+set}" = set; then :
+  enableval=$enable_prelink; PRELINK_CHECK=t
+else
+  PRELINK_CHECK=
+fi
+
+
 # Check whether --enable-fastimmfix was given.
 if test "${enable_fastimmfix+set}" = set; then :
   enableval=$enable_fastimmfix;
@@ -9330,6 +9341,8 @@ O2FLAGS=$TO2FLAGS
 
 
 
+
+
 
 
 if test -f h/$use.defs  ; then
--- gcl-2.6.10.orig/configure.in
+++ gcl-2.6.10/configure.in
@@ -36,6 +36,8 @@ if test "$enable_safecdr" = "yes" ; then
 fi
 AC_ARG_ENABLE(safecdrdbg,[debug safecdr code],[AC_DEFINE([DEBUG_SAFE_CDR],[1],[debug safecdr code])])
 
+AC_ARG_ENABLE([prelink],[--enable-prelink will insist that the produced images may be prelinked],[PRELINK_CHECK=t],[PRELINK_CHECK=])
+
 AC_ARG_ENABLE([fastimmfix],[--enable-fastimmfix=XXXX will reject low immediate fixnums unless 1<<XXXX can be attained],
 ,[enable_fastimmfix=64])
 
@@ -2755,6 +2757,8 @@ AC_SUBST(O3FLAGS)
 O2FLAGS=$TO2FLAGS
 AC_SUBST(O2FLAGS)
 
+AC_SUBST(PRELINK_CHECK)
+
 AC_SUBST(EXTRA_LOBJS)
 AC_SUBST(LEADING_UNDERSCORE)
 AC_SUBST(GNU_LD)
--- gcl-2.6.10.orig/h/m68k-linux.h
+++ gcl-2.6.10/h/m68k-linux.h
@@ -76,3 +76,5 @@ int cacheflush(void *,int,int,int);
 #define C_GC_OFFSET 2
 
 #define RELOC_H "elf32_m68k_reloc.h"
+
+#define NEED_STACK_CHK_GUARD
--- gcl-2.6.10.orig/makedefc.in
+++ gcl-2.6.10/makedefc.in
@@ -40,6 +40,9 @@ TCL_LIB_SPEC=@TCL_LIB_SPEC@
 TCL_DL_LIBS=@TCL_DL_LIBS@
 TCL_LIBS=@TCL_LIBS@
 
+PRELINK_CHECK=@PRELINK_CHECK@
+
+
 NOTIFY=@NOTIFY@
 CC=@CC@
 CFLAGS=@CFLAGS@
--- gcl-2.6.10.orig/makefile
+++ gcl-2.6.10/makefile
@@ -122,7 +122,7 @@ $(GMPDIR)/libgmp.a: $(GMPDIR)/Makefile
 	cd $(GMPDIR) && $(MAKE) && rm -f libgmp.a &&  ar qc libgmp.a *.o */*.o
 
 gmp_all: $(GMPDIR)/Makefile
-	cd $(GMPDIR) && $(MAKE) 
+	cd $(GMPDIR) && echo '#include <stdio.h>' >> gmp.h && echo "#include \"`pwd`/../h/prelink.h\"" >> gmp.h && $(MAKE) 
 	touch $@
 
 $(GMPDIR)/mpn/mul_n.o $(GMPDIR)/mpn/lshift.o $(GMPDIR)/mpn/rshift.o: $(GMPDIR)/Makefile
--- gcl-2.6.10.orig/unixport/makefile
+++ gcl-2.6.10/unixport/makefile
@@ -129,7 +129,11 @@ saved_%:raw_% $(RSYM) init_%.lsp raw_%_m
 	ar x lib$*.a $$(ar t lib$*.a |grep ^gcl_)
 	$(PORTDIR)/raw_$*$(EXE) $(PORTDIR)/ -libdir $(GCLDIR)/ < foo
 #       check that saved image can be prelinked
-	! [ -x /usr/bin/objdump ] || ! /usr/bin/objdump -f $@ | grep "file format" | grep "elf" || ! /usr/bin/objdump -R $@ |grep R_.*_COPY
+	[ "$(PRELINK_CHECK)" = "" ] || \
+		! [ -x /usr/bin/objdump ] || \
+		! /usr/bin/objdump -f $@ | grep "file format" | grep "elf" || \
+		! /usr/bin/objdump -R $@ |grep R_.*_COPY || \
+		! echo "$@ cannot be prelinked"
 
 $(RSYM): $(SPECIAL_RSYM) $(HDIR)/mdefs.h
 	$(CC) $(LD_FLAGS) $(CFLAGS) -I$(HDIR) -I$(ODIR) -o $(RSYM) $(SPECIAL_RSYM)
