<short summary of the patch>
authorCamm Maguire <camm@debian.org>
Sun, 13 Nov 2022 12:55:14 +0000 (12:55 +0000)
committerCamm Maguire <camm@debian.org>
Sun, 13 Nov 2022 12:55:14 +0000 (12:55 +0000)
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-67) unstable; urgency=medium

  * Version_2_6_13pre55

Gbp-Pq: Name Version_2_6_13pre56

h/elf64_alpha_reloc.h
h/elf64_alpha_reloc_special.h

index 275a84fd982dc10e5cd47a26d4a74774292d45f9..9c5e8f8280387be919191e2b4b272a617e468a80 100644 (file)
       store_val(where,MASK(32),s+a);
       break;
     case R_ALPHA_LITERAL:
-      s+=a;
-      if (a || !(sym->st_other&0x1)) {gotp+=1+(sym->st_other>>1);sym->st_other|=1;}
-      gote=got+(a ? gotp : sym->st_size)-1;
-      massert(s); 
+      gote=got+(a>>32)-1;
+      a&=MASK(32);
       if (s>=ggot1 && s<ggote) {
         massert(!write_stub(s,got,gote));
       } else 
-       *gote=s;
+       *gote=s+a;
       s=(gote-got)*sizeof(*got);
-      massert(!(s&0x8000));
+      massert(!(s&~MASK(16)));
       store_val(where,MASK(16),s);
       break;
     case R_ALPHA_GPRELHIGH:
index 3ecb7ec0634c651d99b4ec85940eee6befbd7f3e..a93e97e96a31a206367dfdaba786f210f7a3865b 100644 (file)
@@ -1,4 +1,4 @@
-static ul ggot1,ggote,gotp;
+static ul ggot1,ggote;
 
 static int
 write_stub(ul s,ul *got,ul *gote) {
@@ -65,12 +65,24 @@ label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char
   Sym *sym;
   Shdr *sec;
   void *v,*ve;
-  ul q=0;
+  ul q=0,a;
 
-  gotp=0;
   for (sym=sym1;sym<syme;sym++)
     sym->st_other=sym->st_size=0;
 
+  for (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_ALPHA_LITERAL) {
+
+         sym=sym1+ELF_R_SYM(r->r_info);
+
+         /*unlikely to save got space by recording possible holes in addend range*/
+         if ((a=r->r_addend+1)>sym->st_other)
+           sym->st_other=a;
+
+       }
+
   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)
@@ -78,13 +90,19 @@ label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char
 
          sym=sym1+ELF_R_SYM(r->r_info);
            
-         if (!sym->st_size || r->r_addend) { 
-           q=++*gs; 
-           if (!sym->st_size) sym->st_size=q;
+         if (sym->st_other) {
+           sym->st_size=++*gs;
            massert(!make_got_room_for_stub(sec1,sece,sym,st1,gs));
-           sym->st_other=(*gs-q)<<1;
+           massert((*gs-sym->st_size) || !r->r_addend);
+           if (sym->st_other>1)
+             (*gs)+=sym->st_other-1;
+           sym->st_other=0;
          }
 
+         b=sizeof(r->r_addend)*4;
+         massert(!(r->r_addend>>b));
+         r->r_addend|=((sym->st_size+r->r_addend)<<b);
+
        }
   
   return 0;