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-88) unstable; urgency=medium
 .
   * Source only upload
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-12-07

--- gcl-2.6.12.orig/h/elf64_ppcle_reloc.h
+++ gcl-2.6.12/h/elf64_ppcle_reloc.h
@@ -1,9 +1,25 @@
+#define R_PPC64_PLTSEQ  119  /*FIXME not in elf.h*/
+#define R_PPC64_PLTCALL 120
+
 #define ha(x_) ((((x_) >> 16) + (((x_) & 0x8000) ? 1 : 0)) & 0xffff)
 #define lo(x_) ((x_) & 0xffff)
 
     case R_PPC64_REL16_HA: 
       store_val(where,MASK(16),ha(s+a-p));
       break;
+    case R_PPC64_PLT16_HA:
+      gote=got+sym->st_size-1;
+      *gote=s+a;
+      store_val(where,MASK(16),ha((ul)gote-toc->st_value));
+      break;
+    case R_PPC64_PLT16_LO_DS:
+      gote=got+sym->st_size-1;
+      *gote=s+a;
+      store_val(where,MASK(16),lo((ul)gote-toc->st_value));/*>>2*/
+      break;
+    case R_PPC64_PLTSEQ:
+    case R_PPC64_PLTCALL:
+      break;
     case R_PPC64_TOC16_HA: 
       store_val(where,MASK(16),ha(s+a-toc->st_value));
       break;
--- gcl-2.6.12.orig/h/elf64_ppcle_reloc_special.h
+++ gcl-2.6.12/h/elf64_ppcle_reloc_special.h
@@ -9,16 +9,12 @@ static int tramp[]={0,0,
 };
 
 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) {
-  
-  Shdr *sec;
+load_trampolines(void *v,Shdr *sec,Sym *ds1) {
+
   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;
 
@@ -42,8 +38,25 @@ find_special_params(void *v,Shdr *sec1,S
 }
 
 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) {
+
+  Shdr *sec;
+
+  massert((sec=get_section(".rela.dyn",sec1,sece,sn)));
+  massert(!load_trampolines(v,sec,ds1));
+  if ((sec=get_section(".rela.plt",sec1,sece,sn)))
+    massert(!load_trampolines(v,sec,ds1));
+
+  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) {
 
+  Rela *r;
+  void *v,*ve;
   Shdr *sec;
   Sym *sym;
   
@@ -58,6 +71,22 @@ label_got_symbols(void *v1,Shdr *sec1,Sh
     }
   }
 
+  for (sym=sym1;sym<syme;sym++)
+   sym->st_size=0;
+
+  for (*gs=0,sec=sec1;sec<sece;sec++)
+    if (sec->sh_type==SHT_RELA)
+      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_PPC64_PLT16_HA||
+	    ELF_R_TYPE(r->r_info)==R_PPC64_PLT16_LO_DS) {
+
+	  sym=sym1+ELF_R_SYM(r->r_info);
+
+	  if (!sym->st_size)
+	    sym->st_size=++*gs;
+
+	}
+
   return 0;
   
 }