Blob Blame History Raw
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.12-81) unstable; urgency=high
 .
   * Version_2_6_13pre72
   * Fix to ppc64el for acl2 FTBFS bug
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: https://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: 2019-02-02

--- gcl-2.6.12.orig/configure
+++ gcl-2.6.12/configure
@@ -4181,7 +4181,7 @@ case $use in
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
 		;;
 	    arm*)
-		assert_arg_to_cflags -mlong-calls
+#		assert_arg_to_cflags -mlong-calls
 		assert_arg_to_cflags -fdollars-in-identifiers
 		assert_arg_to_cflags -g #?
 		;;
--- gcl-2.6.12.orig/configure.in
+++ gcl-2.6.12/configure.in
@@ -388,7 +388,7 @@ case $use in
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
 		;;
 	    arm*)
-		assert_arg_to_cflags -mlong-calls
+#		assert_arg_to_cflags -mlong-calls
 		assert_arg_to_cflags -fdollars-in-identifiers
 		assert_arg_to_cflags -g #?
 		;;
--- gcl-2.6.12.orig/h/arm-linux.h
+++ gcl-2.6.12/h/arm-linux.h
@@ -12,5 +12,6 @@
 #define SGC
 
 #define RELOC_H "elf32_arm_reloc.h"
+#define SPECIAL_RELOC_H "elf32_arm_reloc_special.h"
 
 #define NEED_STACK_CHK_GUARD
--- gcl-2.6.12.orig/h/elf32_arm_reloc.h
+++ gcl-2.6.12/h/elf32_arm_reloc.h
@@ -53,11 +53,21 @@
       break;
     case R_ARM_CALL:
     case R_ARM_JUMP24:
-      add_vals(where,MASK(24),((long)(s+a-p))>>2);
+      massert(!a);
+      {
+	long x=((long)(s-p))/4;
+	if (abs(x)&(~MASK(23))) {
+          got+=(sym->st_size-1)*tz;
+	  memcpy(got,tramp,sizeof(tramp));
+          got[sizeof(tramp)/sizeof(*got)]=s;
+	  x=((long)got-p)/4;
+	}
+	add_vals(where,MASK(24),x);
+      }
       break;
     case R_ARM_ABS32:
-      add_val(where,~0L,s+a);
+      add_vals(where,~0L,s+a);
       break;
     case R_ARM_V4BX:
-      add_val(where,~0L,s+a);
+      add_vals(where,~0L,s+a);
       break;
--- /dev/null
+++ gcl-2.6.12/h/elf32_arm_reloc_special.h
@@ -0,0 +1,43 @@
+/* #define R_AARCH64_TRAMP 1 */
+static int tramp[]={0xe59fc000,  /*ldr r12, [pc]*/ /*FIXME?  Can this refer to an earlier address?*/
+		    0xe12fff1c}; /*br r12*/
+static ul tz=1+sizeof(tramp)/sizeof(ul);
+
+
+static int
+find_special_params(void *v,Shdr *sec1,Shdr *sece,const char *sn,
+		    const char *st1,Sym *ds1,Sym *dse,Sym *sym,Sym *syme) {
+
+  return 0;
+
+}
+
+static int
+label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char *st1,const char *sn,ul *gs) {
+
+  Rel *r;
+  Sym *sym;
+  Shdr *sec;
+  void *v,*ve;
+
+  for (sym=sym1;sym<syme;sym++)
+    sym->st_size=0;
+
+  for (*gs=0,sec=sec1;sec<sece;sec++)
+    if (sec->sh_type==SHT_REL)
+      for (v=v1+sec->sh_offset,ve=v+sec->sh_size,r=v;v<ve;v+=sec->sh_entsize,r=v)
+	if (ELF_R_TYPE(r->r_info)==R_ARM_CALL ||
+	    ELF_R_TYPE(r->r_info)==R_ARM_JUMP24) {
+
+	  sym=sym1+ELF_R_SYM(r->r_info);
+
+	  if (!sym->st_size)
+	    sym->st_size=++*gs;
+
+	}
+
+  (*gs)*=tz;
+
+  return 0;
+
+}