2b15d05
Description: <short summary of the patch>
2b15d05
 TODO: Put a short summary on the line above and replace this paragraph
2b15d05
 with a longer explanation of this change. Complete the meta-information
2b15d05
 with other relevant fields (see below for details). To make it easier, the
2b15d05
 information below has been extracted from the changelog. Adjust it or drop
2b15d05
 it.
2b15d05
 .
2b15d05
 gcl (2.6.12-88) unstable; urgency=medium
2b15d05
 .
2b15d05
   * Source only upload
2b15d05
Author: Camm Maguire <camm@debian.org>
2b15d05
2b15d05
---
2b15d05
The information above should follow the Patch Tagging Guidelines, please
2b15d05
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
2b15d05
are templates for supplementary fields that you might want to add:
2b15d05
2b15d05
Origin: <vendor|upstream|other>, <url of original patch>
2b15d05
Bug: <url in upstream bugtracker>
2b15d05
Bug-Debian: https://bugs.debian.org/<bugnumber>
2b15d05
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
2b15d05
Forwarded: <no|not-needed|url proving that it has been forwarded>
2b15d05
Reviewed-By: <name and email of someone who approved the patch>
2b15d05
Last-Update: 2019-12-07
2b15d05
2b15d05
--- gcl-2.6.12.orig/h/elf64_ppcle_reloc.h
2b15d05
+++ gcl-2.6.12/h/elf64_ppcle_reloc.h
2b15d05
@@ -1,9 +1,25 @@
2b15d05
+#define R_PPC64_PLTSEQ  119  /*FIXME not in elf.h*/
2b15d05
+#define R_PPC64_PLTCALL 120
2b15d05
+
2b15d05
 #define ha(x_) ((((x_) >> 16) + (((x_) & 0x8000) ? 1 : 0)) & 0xffff)
2b15d05
 #define lo(x_) ((x_) & 0xffff)
2b15d05
 
2b15d05
     case R_PPC64_REL16_HA: 
2b15d05
       store_val(where,MASK(16),ha(s+a-p));
2b15d05
       break;
2b15d05
+    case R_PPC64_PLT16_HA:
2b15d05
+      gote=got+sym->st_size-1;
2b15d05
+      *gote=s+a;
2b15d05
+      store_val(where,MASK(16),ha((ul)gote-toc->st_value));
2b15d05
+      break;
2b15d05
+    case R_PPC64_PLT16_LO_DS:
2b15d05
+      gote=got+sym->st_size-1;
2b15d05
+      *gote=s+a;
2b15d05
+      store_val(where,MASK(16),lo((ul)gote-toc->st_value));/*>>2*/
2b15d05
+      break;
2b15d05
+    case R_PPC64_PLTSEQ:
2b15d05
+    case R_PPC64_PLTCALL:
2b15d05
+      break;
2b15d05
     case R_PPC64_TOC16_HA: 
2b15d05
       store_val(where,MASK(16),ha(s+a-toc->st_value));
2b15d05
       break;
2b15d05
--- gcl-2.6.12.orig/h/elf64_ppcle_reloc_special.h
2b15d05
+++ gcl-2.6.12/h/elf64_ppcle_reloc_special.h
2b15d05
@@ -9,16 +9,12 @@ static int tramp[]={0,0,
2b15d05
 };
2b15d05
 
2b15d05
 static int
2b15d05
-find_special_params(void *v,Shdr *sec1,Shdr *sece,const char *sn,
2b15d05
-		    const char *st1,Sym *ds1,Sym *dse,Sym *sym,Sym *syme) {
2b15d05
-  
2b15d05
-  Shdr *sec;
2b15d05
+load_trampolines(void *v,Shdr *sec,Sym *ds1) {
2b15d05
+
2b15d05
   Rela *r;
2b15d05
   void *ve;
2b15d05
   ul *u,j;
2b15d05
 
2b15d05
-  massert((sec=get_section(".rela.dyn",sec1,sece,sn)));
2b15d05
-
2b15d05
   v+=sec->sh_offset;
2b15d05
   ve=v+sec->sh_size;
2b15d05
 
2b15d05
@@ -42,8 +38,25 @@ find_special_params(void *v,Shdr *sec1,S
2b15d05
 }
2b15d05
 
2b15d05
 static int
2b15d05
+find_special_params(void *v,Shdr *sec1,Shdr *sece,const char *sn,
2b15d05
+		    const char *st1,Sym *ds1,Sym *dse,Sym *sym,Sym *syme) {
2b15d05
+
2b15d05
+  Shdr *sec;
2b15d05
+
2b15d05
+  massert((sec=get_section(".rela.dyn",sec1,sece,sn)));
2b15d05
+  massert(!load_trampolines(v,sec,ds1));
2b15d05
+  if ((sec=get_section(".rela.plt",sec1,sece,sn)))
2b15d05
+    massert(!load_trampolines(v,sec,ds1));
2b15d05
+
2b15d05
+  return 0;
2b15d05
+
2b15d05
+}
2b15d05
+
2b15d05
+static int
2b15d05
 label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char *st1,const char *sn,ul *gs) {
2b15d05
 
2b15d05
+  Rela *r;
2b15d05
+  void *v,*ve;
2b15d05
   Shdr *sec;
2b15d05
   Sym *sym;
2b15d05
   
2b15d05
@@ -58,6 +71,22 @@ label_got_symbols(void *v1,Shdr *sec1,Sh
2b15d05
     }
2b15d05
   }
2b15d05
 
2b15d05
+  for (sym=sym1;sym
2b15d05
+   sym->st_size=0;
2b15d05
+
2b15d05
+  for (*gs=0,sec=sec1;sec
2b15d05
+    if (sec->sh_type==SHT_RELA)
2b15d05
+      for (v=v1+sec->sh_offset,ve=v+sec->sh_size,r=v;v<ve;v+=sec->sh_entsize,r=v)
2b15d05
+	if (ELF_R_TYPE(r->r_info)==R_PPC64_PLT16_HA||
2b15d05
+	    ELF_R_TYPE(r->r_info)==R_PPC64_PLT16_LO_DS) {
2b15d05
+
2b15d05
+	  sym=sym1+ELF_R_SYM(r->r_info);
2b15d05
+
2b15d05
+	  if (!sym->st_size)
2b15d05
+	    sym->st_size=++*gs;
2b15d05
+
2b15d05
+	}
2b15d05
+
2b15d05
   return 0;
2b15d05
   
2b15d05
 }