385abae
Description: <short summary of the patch>
385abae
 TODO: Put a short summary on the line above and replace this paragraph
385abae
 with a longer explanation of this change. Complete the meta-information
385abae
 with other relevant fields (see below for details). To make it easier, the
385abae
 information below has been extracted from the changelog. Adjust it or drop
385abae
 it.
385abae
 .
385abae
 gcl (2.6.12-81) unstable; urgency=high
385abae
 .
385abae
   * Version_2_6_13pre72
385abae
   * Fix to ppc64el for acl2 FTBFS bug
385abae
Author: Camm Maguire <camm@debian.org>
385abae
385abae
---
385abae
The information above should follow the Patch Tagging Guidelines, please
385abae
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
385abae
are templates for supplementary fields that you might want to add:
385abae
385abae
Origin: <vendor|upstream|other>, <url of original patch>
385abae
Bug: <url in upstream bugtracker>
385abae
Bug-Debian: https://bugs.debian.org/<bugnumber>
385abae
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
385abae
Forwarded: <no|not-needed|url proving that it has been forwarded>
385abae
Reviewed-By: <name and email of someone who approved the patch>
385abae
Last-Update: 2019-02-02
385abae
385abae
--- gcl-2.6.12.orig/configure
385abae
+++ gcl-2.6.12/configure
385abae
@@ -4181,7 +4181,7 @@ case $use in
385abae
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
385abae
 		;;
385abae
 	    arm*)
385abae
-		assert_arg_to_cflags -mlong-calls
385abae
+#		assert_arg_to_cflags -mlong-calls
385abae
 		assert_arg_to_cflags -fdollars-in-identifiers
385abae
 		assert_arg_to_cflags -g #?
385abae
 		;;
385abae
--- gcl-2.6.12.orig/configure.in
385abae
+++ gcl-2.6.12/configure.in
385abae
@@ -388,7 +388,7 @@ case $use in
385abae
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
385abae
 		;;
385abae
 	    arm*)
385abae
-		assert_arg_to_cflags -mlong-calls
385abae
+#		assert_arg_to_cflags -mlong-calls
385abae
 		assert_arg_to_cflags -fdollars-in-identifiers
385abae
 		assert_arg_to_cflags -g #?
385abae
 		;;
385abae
--- gcl-2.6.12.orig/h/arm-linux.h
385abae
+++ gcl-2.6.12/h/arm-linux.h
385abae
@@ -12,5 +12,6 @@
385abae
 #define SGC
385abae
 
385abae
 #define RELOC_H "elf32_arm_reloc.h"
385abae
+#define SPECIAL_RELOC_H "elf32_arm_reloc_special.h"
385abae
 
385abae
 #define NEED_STACK_CHK_GUARD
385abae
--- gcl-2.6.12.orig/h/elf32_arm_reloc.h
385abae
+++ gcl-2.6.12/h/elf32_arm_reloc.h
385abae
@@ -53,11 +53,21 @@
385abae
       break;
385abae
     case R_ARM_CALL:
385abae
     case R_ARM_JUMP24:
385abae
-      add_vals(where,MASK(24),((long)(s+a-p))>>2);
385abae
+      massert(!a);
385abae
+      {
385abae
+	long x=((long)(s-p))/4;
385abae
+	if (abs(x)&(~MASK(23))) {
385abae
+          got+=(sym->st_size-1)*tz;
385abae
+	  memcpy(got,tramp,sizeof(tramp));
385abae
+          got[sizeof(tramp)/sizeof(*got)]=s;
385abae
+	  x=((long)got-p)/4;
385abae
+	}
385abae
+	add_vals(where,MASK(24),x);
385abae
+      }
385abae
       break;
385abae
     case R_ARM_ABS32:
385abae
-      add_val(where,~0L,s+a);
385abae
+      add_vals(where,~0L,s+a);
385abae
       break;
385abae
     case R_ARM_V4BX:
385abae
-      add_val(where,~0L,s+a);
385abae
+      add_vals(where,~0L,s+a);
385abae
       break;
385abae
--- /dev/null
385abae
+++ gcl-2.6.12/h/elf32_arm_reloc_special.h
385abae
@@ -0,0 +1,43 @@
385abae
+/* #define R_AARCH64_TRAMP 1 */
385abae
+static int tramp[]={0xe59fc000,  /*ldr r12, [pc]*/ /*FIXME?  Can this refer to an earlier address?*/
385abae
+		    0xe12fff1c}; /*br r12*/
385abae
+static ul tz=1+sizeof(tramp)/sizeof(ul);
385abae
+
385abae
+
385abae
+static int
385abae
+find_special_params(void *v,Shdr *sec1,Shdr *sece,const char *sn,
385abae
+		    const char *st1,Sym *ds1,Sym *dse,Sym *sym,Sym *syme) {
385abae
+
385abae
+  return 0;
385abae
+
385abae
+}
385abae
+
385abae
+static int
385abae
+label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char *st1,const char *sn,ul *gs) {
385abae
+
385abae
+  Rel *r;
385abae
+  Sym *sym;
385abae
+  Shdr *sec;
385abae
+  void *v,*ve;
385abae
+
385abae
+  for (sym=sym1;sym
385abae
+    sym->st_size=0;
385abae
+
385abae
+  for (*gs=0,sec=sec1;sec
385abae
+    if (sec->sh_type==SHT_REL)
385abae
+      for (v=v1+sec->sh_offset,ve=v+sec->sh_size,r=v;v<ve;v+=sec->sh_entsize,r=v)
385abae
+	if (ELF_R_TYPE(r->r_info)==R_ARM_CALL ||
385abae
+	    ELF_R_TYPE(r->r_info)==R_ARM_JUMP24) {
385abae
+
385abae
+	  sym=sym1+ELF_R_SYM(r->r_info);
385abae
+
385abae
+	  if (!sym->st_size)
385abae
+	    sym->st_size=++*gs;
385abae
+
385abae
+	}
385abae
+
385abae
+  (*gs)*=tz;
385abae
+
385abae
+  return 0;
385abae
+
385abae
+}