From ce3be4b58a646408db5c05a77a170fe522c57d7d Mon Sep 17 00:00:00 2001 From: Camm Maguire Date: Thu, 11 Aug 2022 18:16:42 +0100 Subject: [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 Gbp-Pq: Name Version_2_6_13pre73 --- configure | 2 +- configure.in | 2 +- h/arm-linux.h | 1 + h/elf32_arm_reloc.h | 16 +++++++++++--- h/elf32_arm_reloc_special.h | 43 +++++++++++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 h/elf32_arm_reloc_special.h diff --git a/configure b/configure index f1e0ab0..dff1b03 100755 --- a/configure +++ b/configure @@ -4181,7 +4181,7 @@ case $use in if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1 ;; arm*) - assert_arg_to_cflags -mlong-calls +# assert_arg_to_cflags -mlong-calls assert_arg_to_cflags -fdollars-in-identifiers assert_arg_to_cflags -g #? ;; diff --git a/configure.in b/configure.in index 6794657..60ac5f1 100644 --- a/configure.in +++ b/configure.in @@ -388,7 +388,7 @@ case $use in if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1 ;; arm*) - assert_arg_to_cflags -mlong-calls +# assert_arg_to_cflags -mlong-calls assert_arg_to_cflags -fdollars-in-identifiers assert_arg_to_cflags -g #? ;; diff --git a/h/arm-linux.h b/h/arm-linux.h index 3782c8f..81d86ce 100755 --- a/h/arm-linux.h +++ b/h/arm-linux.h @@ -12,5 +12,6 @@ #define SGC #define RELOC_H "elf32_arm_reloc.h" +#define SPECIAL_RELOC_H "elf32_arm_reloc_special.h" #define NEED_STACK_CHK_GUARD diff --git a/h/elf32_arm_reloc.h b/h/elf32_arm_reloc.h index fc07043..6a504e4 100644 --- a/h/elf32_arm_reloc.h +++ b/h/elf32_arm_reloc.h @@ -53,11 +53,21 @@ break; case R_ARM_CALL: case R_ARM_JUMP24: - add_vals(where,MASK(24),((long)(s+a-p))>>2); + massert(!a); + { + long x=((long)(s-p))/4; + if (abs(x)&(~MASK(23))) { + got+=(sym->st_size-1)*tz; + memcpy(got,tramp,sizeof(tramp)); + got[sizeof(tramp)/sizeof(*got)]=s; + x=((long)got-p)/4; + } + add_vals(where,MASK(24),x); + } break; case R_ARM_ABS32: - add_val(where,~0L,s+a); + add_vals(where,~0L,s+a); break; case R_ARM_V4BX: - add_val(where,~0L,s+a); + add_vals(where,~0L,s+a); break; diff --git a/h/elf32_arm_reloc_special.h b/h/elf32_arm_reloc_special.h new file mode 100644 index 0000000..0c3b692 --- /dev/null +++ b/h/elf32_arm_reloc_special.h @@ -0,0 +1,43 @@ +/* #define R_AARCH64_TRAMP 1 */ +static int tramp[]={0xe59fc000, /*ldr r12, [pc]*/ /*FIXME? Can this refer to an earlier address?*/ + 0xe12fff1c}; /*br r12*/ +static ul tz=1+sizeof(tramp)/sizeof(ul); + + +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) { + + 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) { + + Rel *r; + Sym *sym; + Shdr *sec; + void *v,*ve; + + for (sym=sym1;symst_size=0; + + for (*gs=0,sec=sec1;secsh_type==SHT_REL) + for (v=v1+sec->sh_offset,ve=v+sec->sh_size,r=v;vsh_entsize,r=v) + if (ELF_R_TYPE(r->r_info)==R_ARM_CALL || + ELF_R_TYPE(r->r_info)==R_ARM_JUMP24) { + + sym=sym1+ELF_R_SYM(r->r_info); + + if (!sym->st_size) + sym->st_size=++*gs; + + } + + (*gs)*=tz; + + return 0; + +} -- 2.30.2