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-01-21

--- gcl-2.6.12.orig/h/elf64_ppcle_reloc_special.h
+++ gcl-2.6.12/h/elf64_ppcle_reloc_special.h
@@ -1,12 +1,12 @@
 static Sym *toc;
 
-/* static int tramp[]={0,0, */
-/* 		    (((0x3a<<10)|(0x9<<5)|0xc)<<16)|0xfff8,/\*ld      r9,-8(r12)*\/ */
-/* 		    ((0x3a<<10)|(0x9<<5)|0x9)<<16,         /\*ld      r9,0(r9)*\/ */
-/* 		    0x7d2c4b78,                            /\*mr      r12,r9 *\/ */
-/* 		    0x7d8903a6,                            /\*mtctr   r12*\/ */
-/* 		    0x4e800420                             /\*bctrl*\/ */
-/* }; */
+static int tramp[]={0,0,
+		    (((0x3a<<10)|(0x9<<5)|0xc)<<16)|0xfff8,/*ld      r9,-8(r12)*/
+		    ((0x3a<<10)|(0x9<<5)|0x9)<<16,         /*ld      r9,0(r9)*/
+		    0x7d2c4b78,                            /*mr      r12,r9 */
+		    0x7d8903a6,                            /*mtctr   r12*/
+		    0x4e800420                             /*bctrl*/
+};
 
 static int
 find_special_params(void *v,Shdr *sec1,Shdr *sece,const char *sn,
@@ -15,41 +15,29 @@ find_special_params(void *v,Shdr *sec1,S
   Shdr *sec;
   Rela *r;
   void *ve;
+  ul *u,j;
 
   massert((sec=get_section(".rela.dyn",sec1,sece,sn)));
 
   v+=sec->sh_offset;
   ve=v+sec->sh_size;
 
-  for (r=v;v<ve;v+=sec->sh_entsize,r=v) 
+  for (j=0,r=v;v<ve;v+=sec->sh_entsize,r=v)
     if (ELF_R_TYPE(r->r_info) && !ds1[ELF_R_SYM(r->r_info)].st_value)
-	ds1[ELF_R_SYM(r->r_info)].st_value=*(ul *)r->r_offset;
+      j++;
 
-  return 0;
-
-
-  /* massert((sec=get_section(".rel.dyn",sec1,sece,sn))|| */
-  /* 	  (sec=get_section(".rela.dyn",sec1,sece,sn))); */
+  massert(u=malloc(j*sizeof(tramp)));
 
-  /* v+=sec->sh_offset; */
-  /* ve=v+sec->sh_size; */
+  v=ve-sec->sh_size;
+  for (r=v;v<ve;v+=sec->sh_entsize,r=v)
+    if (ELF_R_TYPE(r->r_info) && !ds1[ELF_R_SYM(r->r_info)].st_value) {
+      memcpy(u,tramp,sizeof(tramp));
+      *u++=r->r_offset;
+      ds1[ELF_R_SYM(r->r_info)].st_value=(ul)u;
+      u=((void *)(u-1)+sizeof(tramp));
+    }
 
-  /* for (j=0,r=v;v<ve;v+=sec->sh_entsize,r=v)  */
-  /*   if (ELF_R_TYPE(r->r_info) && !ds1[ELF_R_SYM(r->r_info)].st_value) */
-  /*     j++; */
-
-  /* massert(u=malloc(j*sizeof(tramp))); */
-
-  /* v=ve-sec->sh_size; */
-  /* for (r=v;v<ve;v+=sec->sh_entsize,r=v)  */
-  /*   if (ELF_R_TYPE(r->r_info) && !ds1[ELF_R_SYM(r->r_info)].st_value) { */
-  /*     memcpy(u,tramp,sizeof(tramp)); */
-  /*     *u++=r->r_offset; */
-  /*     ds1[ELF_R_SYM(r->r_info)].st_value=(ul)u; */
-  /*     u=((void *)(u-1)+sizeof(tramp)); */
-  /*   } */
-
-  /* return 0; */
+  return 0;
 
 }