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.13-6) unstable; urgency=medium
 .
   * Version_2_6_14pre5
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2023-01-08

--- gcl-2.6.13.orig/configure
+++ gcl-2.6.13/configure
@@ -4888,17 +4888,6 @@ if test "$FOMITF" != "" ; then
     TO3FLAGS="$TO3FLAGS $FOMITF"
 fi
 
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking gcc version 12" >&5
-printf %s "checking gcc version 12... " >&6; }
-if $CC -v 2>&1|grep gcc |grep -q 'version 12'; then
-   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
-   assert_arg_to_cflags -fno-tree-vrp #Bug workaround
-else
-   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-fi
-
 # Step 1: set the variable "system" to hold the name and version number
 # for the system.  This can usually be done via the "uname" command, but
 # there are a few systems, like Next, where this doesn't work.
@@ -7484,6 +7473,21 @@ printf %s "checking finding default link
     if test "`cat gcl.script | wc -l`" != "0" ; then
 	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: got it" >&5
 printf "%s\n" "got it" >&6; }
+
+	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking output_arch" >&5
+printf %s "checking output_arch... " >&6; }
+	output_arch=`cat gcl.script |grep OUTPUT_ARCH|head -n 1|sed 's,.*(\(.*\)).*,\1,1'|cut -f1 -d:`;
+	if test "$output_arch" != "" ; then
+
+printf "%s\n" "#define OUTPUT_ARCH bfd_arch_${output_arch}" >>confdefs.h
+
+     	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: bfd_arch_${output_arch}" >&5
+printf "%s\n" "bfd_arch_${output_arch}" >&6; }
+	else
+     	    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+printf "%s\n" "not found" >&6; }
+	fi
+
 	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying to adjust text start" >&5
 printf "%s\n" "$as_me: trying to adjust text start" >&6;}
 	cp gcl.script gcl.script.def
@@ -7692,10 +7696,10 @@ if test "$enable_immfix" != "no" ; then
     if test "$mem_top" != "0x0" ; then
 	if test "$mem_range" != "0x0" ; then
 
-printf "%s\n" "#define IM_FIX_BASE $mem_top" >>confdefs.h
+printf "%s\n" "#define IM_FIX_BASE ${mem_top}UL" >>confdefs.h
 
 
-printf "%s\n" "#define IM_FIX_LIM $mem_range" >>confdefs.h
+printf "%s\n" "#define IM_FIX_LIM ${mem_range}UL" >>confdefs.h
 
 	fi
     fi
@@ -9226,17 +9230,7 @@ printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6
 if test "x$ac_cv_lib_dl_dlopen" = xyes
 then :
   #opcodes changes too quickly to link directly
-
-  for ac_func in print_insn_i386
-do :
-  ac_fn_c_check_func "$LINENO" "print_insn_i386" "ac_cv_func_print_insn_i386"
-if test "x$ac_cv_func_print_insn_i386" = xyes
-then :
-  printf "%s\n" "#define HAVE_PRINT_INSN_I386 1" >>confdefs.h
- LIBS="$MLIBS -ldl"
-fi
-
-done
+			      LIBS="$MLIBS -ldl"
 fi
 
 fi
--- gcl-2.6.13.orig/configure.in
+++ gcl-2.6.13/configure.in
@@ -491,14 +491,6 @@ if test "$FOMITF" != "" ; then
     TO3FLAGS="$TO3FLAGS $FOMITF"
 fi
 
-AC_MSG_CHECKING([gcc version 12])
-if $CC -v 2>&1|grep gcc |grep -q 'version 12'; then
-   AC_MSG_RESULT([yes])
-   assert_arg_to_cflags -fno-tree-vrp #Bug workaround
-else
-   AC_MSG_RESULT([no])
-fi
-
 # Step 1: set the variable "system" to hold the name and version number
 # for the system.  This can usually be done via the "uname" command, but
 # there are a few systems, like Next, where this doesn't work.
@@ -1397,7 +1389,17 @@ if test "$use" != "386-gnu" ; then #hurd
     rm -rf foo.c foo
 
     if test "`cat gcl.script | wc -l`" != "0" ; then
-	AC_MSG_RESULT(got it)
+	AC_MSG_RESULT([got it])
+
+	AC_MSG_CHECKING([output_arch])
+	output_arch=`cat gcl.script |grep OUTPUT_ARCH|head -n 1|sed 's,.*(\(.*\)).*,\1,1'|cut -f1 -d:`;
+	if test "$output_arch" != "" ; then
+	    AC_DEFINE_UNQUOTED(OUTPUT_ARCH,bfd_arch_${output_arch},[bfd output arch])
+     	    AC_MSG_RESULT([bfd_arch_${output_arch}])
+	else
+     	    AC_MSG_RESULT([not found])
+	fi
+
 	AC_MSG_NOTICE([trying to adjust text start])
 	cp gcl.script gcl.script.def
 	
@@ -1531,8 +1533,8 @@ fi
 if test "$enable_immfix" != "no" ; then
     if test "$mem_top" != "0x0" ; then
 	if test "$mem_range" != "0x0" ; then 
-	    AC_DEFINE_UNQUOTED(IM_FIX_BASE,$mem_top,[beginning address for immediate fixnum range])
-            AC_DEFINE_UNQUOTED(IM_FIX_LIM,$mem_range,[size of immediate fixnum address space])
+	    AC_DEFINE_UNQUOTED(IM_FIX_BASE,${mem_top}UL,[beginning address for immediate fixnum range])
+            AC_DEFINE_UNQUOTED(IM_FIX_LIM,${mem_range}UL,[size of immediate fixnum address space])
 	fi
     fi
 fi
@@ -1969,7 +1971,7 @@ AC_CHECK_HEADERS(dis-asm.h,
 		 MLIBS=$LIBS
 		 AC_CHECK_LIB(opcodes,init_disassemble_info)
 		 AC_CHECK_LIB(dl,dlopen,#opcodes changes too quickly to link directly 
-			      AC_CHECK_FUNCS(print_insn_i386,LIBS="$MLIBS -ldl")))
+			      LIBS="$MLIBS -ldl"))
 
 #if test $use = "386-linux" ; then
 AC_CHECK_HEADERS(asm/sigcontext.h)
--- gcl-2.6.13.orig/git.tag
+++ gcl-2.6.13/git.tag
@@ -1,2 +1,2 @@
-"Version_2_6_14pre4"
+"Version_2_6_14pre5"
 
--- gcl-2.6.13.orig/h/fixnum.h
+++ gcl-2.6.13/h/fixnum.h
@@ -13,12 +13,12 @@
 #define           is_imm_fix(a_)        INT_IN_BITS(a_,LOW_SHFT-1)
 #elif defined (IM_FIX_BASE) && defined(IM_FIX_LIM)
 #define      make_imm_fixnum(a_)        ((object)((a_)+(IM_FIX_BASE+(IM_FIX_LIM>>1))))
-#define       fix_imm_fixnum(a_)        ((fixnum)(((fixnum)(a_))-(IM_FIX_BASE+(IM_FIX_LIM>>1))))
-#define      mark_imm_fixnum(a_)        ((a_)=((object)(((fixnum)(a_)) | IM_FIX_LIM)))
-#define    unmark_imm_fixnum(a_)        ((a_)=((object)(((fixnum)(a_)) &~ IM_FIX_LIM)))
+#define       fix_imm_fixnum(a_)        ((fixnum)(((ufixnum)(a_))-(IM_FIX_BASE+(IM_FIX_LIM>>1))))
+#define      mark_imm_fixnum(a_)        ((a_)=((object)(((ufixnum)(a_)) | IM_FIX_LIM)))
+#define    unmark_imm_fixnum(a_)        ((a_)=((object)(((ufixnum)(a_)) &~ IM_FIX_LIM)))
 #define        is_imm_fixnum(a_)        (((ufixnum)(a_))>=IM_FIX_BASE)
 #define is_unmrkd_imm_fixnum(a_)        (is_imm_fixnum(a_)&&!is_marked_imm_fixnum(a_))
-#define is_marked_imm_fixnum(a_)        (((fixnum)(a_))&IM_FIX_LIM)
+#define is_marked_imm_fixnum(a_)        (((ufixnum)(a_))&IM_FIX_LIM)
 #define           is_imm_fix(a_)        (!(((a_)+(IM_FIX_LIM>>1))&-IM_FIX_LIM))
 /* #define        un_imm_fixnum(a_)        ((a_)=((object)(((fixnum)(a_))&~(IM_FIX_BASE)))) */
 #else
--- gcl-2.6.13.orig/h/gclincl.h.in
+++ gcl-2.6.13/h/gclincl.h.in
@@ -177,9 +177,6 @@
 /* output_bfd element present */
 #undef HAVE_OUTPUT_BFD
 
-/* Define to 1 if you have the `print_insn_i386' function. */
-#undef HAVE_PRINT_INSN_I386
-
 /* have putenv call */
 #undef HAVE_PUTENV
 
@@ -237,9 +234,15 @@
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
@@ -318,6 +321,9 @@
 /* extern inline semantics */
 #undef OLD_INLINE
 
+/* bfd output arch */
+#undef OUTPUT_ARCH
+
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 
@@ -369,6 +375,9 @@
 /* The size of `long', as computed by sizeof. */
 #undef SIZEOF_LONG
 
+/* The size of `time_t', as computed by sizeof. */
+#undef SIZEOF_TIME_T
+
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
    automatically deduced at runtime.
--- gcl-2.6.13.orig/o/main.c
+++ gcl-2.6.13/o/main.c
@@ -1245,7 +1245,7 @@ init_main(void) {
   
 }
 
-#ifdef HAVE_PRINT_INSN_I386
+#ifdef HAVE_DIS_ASM_H
 
 #include "dis-asm.h"
 
@@ -1262,6 +1262,16 @@ my_fprintf(void *v,const char *f,...) {
 }
 
 static int
+my_fprintf_styled(void *v,enum disassembler_style,const char *f,...) {
+  va_list va;
+  int r;
+  va_start(va,f);
+  bp+=(r=vsnprintf(bp,sizeof(b)-(bp-b),f,va));
+  va_end(va);
+  return r;
+}
+
+static int
 my_read(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *dinfo) {
   memcpy(myaddr,(void *)(long)memaddr,length);
   return 0;
@@ -1274,29 +1284,29 @@ my_pa(bfd_vma addr,struct disassemble_in
 
 #endif
 
+
 DEFUN_NEW("DISASSEMBLE-INSTRUCTION",object,fSdisassemble_instruction,SI,1,1,NONE,OI,OO,OO,OO,(fixnum addr),"") {
 
-#ifdef HAVE_PRINT_INSN_I386
+#ifdef OUTPUT_ARCH
 
   static disassemble_info i;
   void *v;
-  int (*s)();
+  void * (*s)();
   int j;
 
-  memset(&i,0,sizeof(i));
-#ifdef __i386__
-  i.disassembler_options="i386";
-#endif
-  i.fprintf_func=my_fprintf;
-  i.read_memory_func=my_read;
-  i.print_address_func=my_pa;
   bp=b;
 
   if ((v=dlopen("libopcodes.so",RTLD_NOW))) {
-    if ((s=dlsym(v,"print_insn_i386"))) {
-      j=s(addr,&i);
-      my_fprintf(NULL," ;");
-      return MMcons(make_simple_string(b),make_fixnum(j));
+    if ((s=dlsym(v,"init_disassemble_info"))) {
+      s(&i, stdout,(fprintf_ftype) my_fprintf,my_fprintf_styled);
+      i.read_memory_func=my_read;
+      i.print_address_func=my_pa;
+      if ((s=dlsym(v,"disassembler"))) {
+	disassembler_ftype disasm=(disassembler_ftype)(ufixnum)s(OUTPUT_ARCH,false,0,NULL);/*bfd_mach_x86_64*/
+	j=disasm(addr,&i);
+	my_fprintf(NULL," ;");
+	return MMcons(make_simple_string(b),make_fixnum(j));
+      }
     }
     massert(!dlclose(v));
   }
