better aarch64 relocation - gcl.git - GNU Common Lisp

index : gcl.git
GNU Common Lisp
summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamm Maguire <camm@debian.org>2014年08月19日 18:18:28 +0000
committerCamm Maguire <camm@debian.org>2014年08月19日 18:18:28 +0000
commite748af45fbc748393f98c160eb0c6406b3a4177b (patch)
treeeb1ff3c7c2855d949a34f083fd827516ba5aa03d
parentdf38cf13f10cbb29a39cb078c10f1d752cc42f24 (diff)
downloadgcl-sgc_mprotect.tar.gz
better aarch64 relocationsgc_mprotect
Diffstat
-rw-r--r--gcl/h/elf64_aarch64_reloc.h 8
-rw-r--r--gcl/h/elf64_aarch64_reloc_special.h 24
2 files changed, 23 insertions, 9 deletions
diff --git a/gcl/h/elf64_aarch64_reloc.h b/gcl/h/elf64_aarch64_reloc.h
index f03d4496d..54c378da6 100644
--- a/gcl/h/elf64_aarch64_reloc.h
+++ b/gcl/h/elf64_aarch64_reloc.h
@@ -9,11 +9,13 @@
{
long x=((long)(s+a-p))/4;
if (abs(x)&(~MASK(25))) {
- got+=gotp;
+ if (a) {
+ got+=gotp;
+ gotp+=tz;
+ } else
+ got+=(sym->st_size-1)*tz;
*got++=s+a;
- gotp++;
memcpy(got,tramp,sizeof(tramp));
- gotp+=sizeof(tramp)/sizeof(*got);
x=((long)got-p)/4;
}
store_vals(where,MASK(26),x);
diff --git a/gcl/h/elf64_aarch64_reloc_special.h b/gcl/h/elf64_aarch64_reloc_special.h
index 87c58c451..2f22c7506 100644
--- a/gcl/h/elf64_aarch64_reloc_special.h
+++ b/gcl/h/elf64_aarch64_reloc_special.h
@@ -1,8 +1,8 @@
/* #define R_AARCH64_TRAMP 1 */
-ul gotp;
-
static int tramp[]={0x58ffffd0, /*ldr 19bit pc relative x16*/
0xd61f0200};/*br x16*/
+static ul gotp,tz=1+sizeof(tramp)/sizeof(ul);
+
static int
find_special_params(void *v,Shdr *sec1,Shdr *sece,const char *sn,
@@ -22,7 +22,7 @@ label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char
gotp=0;
for (sym=sym1;sym<syme;sym++)
- sym->st_other=sym->st_size=0;
+ sym->st_size=0;
for (*gs=0,sec=sec1;sec<sece;sec++)
if (sec->sh_type==SHT_RELA)
@@ -30,12 +30,24 @@ label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char
if (ELF_R_TYPE(r->r_info)==R_AARCH64_JUMP26 ||
ELF_R_TYPE(r->r_info)==R_AARCH64_CALL26) {
- /*FIXME try to figure out earlier if this space is needed*/
- (*gs)+=1+(sizeof(tramp)/sizeof(*gs));
- /* r->r_info=ELF_R_INFO(ELF_R_SYM(r->r_info),R_AARCH64_TRAMP); */
+ if (r->r_addend)
+
+ (*gs)+=tz;
+
+ else {
+
+ sym=sym1+ELF_R_SYM(r->r_info);
+
+ if (!sym->st_size)
+ sym->st_size=++gotp;
+
+ }
}
+ gotp*=tz;
+ (*gs)+=gotp;
+
return 0;
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月01日 23:53:44 +0000

AltStyle によって変換されたページ (->オリジナル) /