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-83) unstable; urgency=high
.
* Version_2_6_13pre75
* FIx acl2 arm builds (Closes: #919477).
Author: Camm Maguire <camm@debian.org>
Bug-Debian: https://bugs.debian.org/919477
---
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-02-05
--- gcl-2.6.12.orig/configure
+++ gcl-2.6.12/configure
@@ -2679,6 +2679,7 @@ case $canonical in
mipsel*linux*) use=mipsel-linux;;
sparc*linux*) use=sparc-linux;;
aarch64*linux*) use=aarch64-linux;;
+ arm*linux*hf) use=armhf-linux;;
arm*linux*) use=arm-linux;;
s390*linux*) use=s390-linux;;
ia64*linux*) use=ia64-linux;;
@@ -4122,11 +4123,12 @@ $as_echo_n "checking working gprof... "
sh4*) enableval="no";;
ia64*) enableval="no";;
hppa*) enableval="no";;
-# arm*) enableval="no";;#FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
+# arm*) if echo $canonical |grep -q hf$; then enableval="no"; fi;;#FIXME CALL and JUMP24 veneers needed for thumb 20190201 #FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
aarch64*) enableval="no";;#unreproducible buildd bug 20170824
*gnu) enableval="no";;
esac
- if test "$enableval" != "yes" ; then
+ GP_FLAG=""
+ if test "$enableval" != "yes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
$as_echo "disabled" >&6; }
else
@@ -4134,7 +4136,8 @@ $as_echo "disabled" >&6; }
$as_echo "ok" >&6; }
OLD_CFLAGS=$CFLAGS # Do not run configure tests with -pg
assert_arg_to_cflags -pg
- CFLAGS=$OLD_CFLAGS
+ GP_FLAG="-pg"
+ CFLAGS=$OLD_CFLAGS
TFPFLAG=""
$as_echo "#define GCL_GPROF 1" >>confdefs.h
@@ -4180,8 +4183,11 @@ case $use in
ia64*)
if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
;;
+ armhf*)
+ assert_arg_to_cflags -fdollars-in-identifiers
+ assert_arg_to_cflags -g #?
+ ;;
arm*)
-# assert_arg_to_cflags -mlong-calls
assert_arg_to_cflags -fdollars-in-identifiers
assert_arg_to_cflags -g #?
;;
@@ -9051,6 +9057,7 @@ LDFLAGS="`echo $LDFLAGS | sed 's,gcl.scr
LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $LIBS $TLIBS"
+CFLAGS="$CFLAGS $GP_FLAG"
FINAL_CFLAGS="$CFLAGS $CPPFLAGS $X_CFLAGS"
# Work around bug with gcc on ppc -- CM
--- gcl-2.6.12.orig/configure.in
+++ gcl-2.6.12/configure.in
@@ -37,6 +37,7 @@ case $canonical in
mipsel*linux*) use=mipsel-linux;;
sparc*linux*) use=sparc-linux;;
aarch64*linux*) use=aarch64-linux;;
+ arm*linux*hf) use=armhf-linux;;
arm*linux*) use=arm-linux;;
s390*linux*) use=s390-linux;;
ia64*linux*) use=ia64-linux;;
@@ -335,17 +336,19 @@ AC_ARG_ENABLE([gprof],[ --enable-gprof
sh4*) enableval="no";;
ia64*) enableval="no";;
hppa*) enableval="no";;
-# arm*) enableval="no";;#FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
+# arm*) if echo $canonical |grep -q hf$; then enableval="no"; fi;;#FIXME CALL and JUMP24 veneers needed for thumb 20190201 #FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
aarch64*) enableval="no";;#unreproducible buildd bug 20170824
*gnu) enableval="no";;
esac
- if test "$enableval" != "yes" ; then
+ GP_FLAG=""
+ if test "$enableval" != "yes" ; then
AC_MSG_RESULT([disabled])
else
AC_MSG_RESULT([ok])
OLD_CFLAGS=$CFLAGS # Do not run configure tests with -pg
assert_arg_to_cflags -pg
- CFLAGS=$OLD_CFLAGS
+ GP_FLAG="-pg"
+ CFLAGS=$OLD_CFLAGS
TFPFLAG=""
AC_DEFINE(GCL_GPROF,1,[use gprof profiling])
fi
@@ -387,8 +390,11 @@ case $use in
ia64*)
if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
;;
+ armhf*)
+ assert_arg_to_cflags -fdollars-in-identifiers
+ assert_arg_to_cflags -g #?
+ ;;
arm*)
-# assert_arg_to_cflags -mlong-calls
assert_arg_to_cflags -fdollars-in-identifiers
assert_arg_to_cflags -g #?
;;
@@ -2108,6 +2114,7 @@ LDFLAGS="`echo $LDFLAGS | sed 's,gcl.scr
AC_SUBST(LDFLAGS)
LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $LIBS $TLIBS"
AC_SUBST(LIBS)
+CFLAGS="$CFLAGS $GP_FLAG"
FINAL_CFLAGS="$CFLAGS $CPPFLAGS $X_CFLAGS"
AC_SUBST(FINAL_CFLAGS)
# Work around bug with gcc on ppc -- CM
--- /dev/null
+++ gcl-2.6.12/h/armhf-linux.h
@@ -0,0 +1,17 @@
+#include "linux.h"
+
+#ifdef IN_GBC
+#undef MPROTECT_ACTION_FLAGS
+#define MPROTECT_ACTION_FLAGS SA_RESTART|SA_SIGINFO
+#define GET_FAULT_ADDR(sig,code,sv,a) \
+ ((siginfo_t *)code)->si_addr
+/* #define GET_FAULT_ADDR(sig,code,sv,a) \ */
+/* ((void *)(*((char ***)(&code)))[44]) */
+#endif
+
+#define SGC
+
+#define RELOC_H "elf32_armhf_reloc.h"
+#define SPECIAL_RELOC_H "elf32_armhf_reloc_special.h"
+
+#define NEED_STACK_CHK_GUARD
--- gcl-2.6.12.orig/h/elf32_arm_reloc.h
+++ gcl-2.6.12/h/elf32_arm_reloc.h
@@ -1,44 +1,7 @@
-#define R_ARM_THM_CALL 10
-#define R_ARM_CALL 28
-#define R_ARM_V4BX 40
-#define R_ARM_THM_MOVW_ABS_NC 47
-#define R_ARM_THM_MOVW_ABS 48
#define R_ARM_MOVW_ABS_NC 43
#define R_ARM_MOVT_ABS 44
- case R_ARM_THM_JUMP24:
- s+=a;
- if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1;
- s-=p+4; /*FIXME maybe drop 4 and add_val below*/
- s=((long)s>>1);
- massert(!(abs(s)&0xff000000));
- store_val(where,MASK(11)<<16,(s&0x7ff)<<16);
- store_val(where,MASK(10),s>>11);
- store_val(where,MASK(1)<<(16+11),(~((s>>21&0x1)^(s>>23&0x1)))<<(16+11));
- store_val(where,MASK(1)<<(16+13),(~((s>>22&0x1)^(s>>23&0x1)))<<(16+13));
- store_val(where,MASK(1)<<10,(s>>23&0x1)<<10);
- break;
- case R_ARM_THM_CALL:
- s+=a;
- if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1;
- s-=p+4; /*FIXME maybe drop 4 and add_val below*/
- s=((long)s>>1);
- massert(!(abs(s)&0xffc00000));
- store_val(where,MASK(11),s>>11);
- store_val(where,MASK(11)<<16,(s&0x7ff)<<16);
- break;
- case R_ARM_THM_MOVW_ABS_NC:
- s+=a;
- if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1;
- s&=0xffff;
- s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
- add_vals(where,~0L,s);
- break;
- case R_ARM_THM_MOVW_ABS:
- s+=a;
- s>>=16;
- s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
- add_vals(where,~0L,s);
- break;
+#define R_ARM_CALL 28
+#define R_ARM_V4BX 40
case R_ARM_MOVW_ABS_NC:
s+=a;
s&=0xffff;
@@ -53,21 +16,21 @@
break;
case R_ARM_CALL:
case R_ARM_JUMP24:
- massert(!a);
{
- long x=((long)(s-p))/4;
- if (abs(x)&(~MASK(23))) {
+ long x=((long)(s+a-p))/4;
+ if (abs(x)&(~MASK(23))) {/*24?*/
got+=(sym->st_size-1)*tz;
memcpy(got,tramp,sizeof(tramp));
+ /*relocate*/
got[sizeof(tramp)/sizeof(*got)]=s;
x=((long)got-p)/4;
}
add_vals(where,MASK(24),x);
}
break;
- case R_ARM_ABS32:
+ case R_ARM_V4BX:
add_vals(where,~0L,s+a);
break;
- case R_ARM_V4BX:
+ case R_ARM_ABS32:
add_vals(where,~0L,s+a);
break;
--- gcl-2.6.12.orig/h/elf32_arm_reloc_special.h
+++ gcl-2.6.12/h/elf32_arm_reloc_special.h
@@ -1,9 +1,7 @@
-/* #define R_AARCH64_TRAMP 1 */
-static int tramp[]={0xe59fc000, /*ldr r12, [pc]*/ /*FIXME? Can this refer to an earlier address?*/
- 0xe12fff1c}; /*br r12*/
+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) {
@@ -26,8 +24,10 @@ label_got_symbols(void *v1,Shdr *sec1,Sh
for (*gs=0,sec=sec1;sec<sece;sec++)
if (sec->sh_type==SHT_REL)
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_ARM_CALL ||
- ELF_R_TYPE(r->r_info)==R_ARM_JUMP24) {
+ 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);
--- /dev/null
+++ gcl-2.6.12/h/elf32_armhf_reloc.h
@@ -0,0 +1,71 @@
+#define R_ARM_THM_CALL 10
+#define R_ARM_THM_MOVW_ABS_NC 47
+#define R_ARM_THM_MOVW_ABS 48
+ case R_ARM_THM_JUMP24:
+ {
+ long x=(long)(s+a-p);
+ if (1||abs(x)&(~MASK(25))) {
+
+ got+=(sym->st_size-1)*tz;
+ memcpy(got,tramp,sizeof(tramp));
+
+ r->r_offset=(void *)got-(void *)start;
+ r->r_info=ELF_R_INFO(ELF_R_SYM(r->r_info),R_ARM_THM_MOVW_ABS_NC);
+ relocate(sym1,r,0,start,got,gote);
+
+ r->r_offset=(void *)(got+1)-(void *)start;
+ r->r_info=ELF_R_INFO(ELF_R_SYM(r->r_info),R_ARM_THM_MOVW_ABS);
+ relocate(sym1,r,0,start,got,gote);
+
+ x=((long)got-p);
+ }
+ if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) x|=1;
+ x-=4; /*FIXME maybe drop 4 and add_val below*/
+ x=((long)x>>1);
+ store_val(where,MASK(11)<<16,(x&0x7ff)<<16);
+ store_val(where,MASK(10),x>>11);
+ store_val(where,MASK(1)<<(16+11),(~((x>>21&0x1)^(x>>23&0x1)))<<(16+11));
+ store_val(where,MASK(1)<<(16+13),(~((x>>22&0x1)^(x>>23&0x1)))<<(16+13));
+ store_val(where,MASK(1)<<10,(x>>23&0x1)<<10);
+ }
+ break;
+ case R_ARM_THM_CALL:
+ {
+ long x=(long)(s+a-p);
+ if (1||abs(x)&(~MASK(23))) {/*24?*/
+ got+=(sym->st_size-1)*tz;
+ memcpy(got,tramp,sizeof(tramp));
+
+ r->r_offset=(void *)got-(void *)start;
+ r->r_info=ELF_R_INFO(ELF_R_SYM(r->r_info),R_ARM_THM_MOVW_ABS_NC);
+ relocate(sym1,r,0,start,got,gote);
+
+ r->r_offset=(void *)(got+1)-(void *)start;
+ r->r_info=ELF_R_INFO(ELF_R_SYM(r->r_info),R_ARM_THM_MOVW_ABS);
+ relocate(sym1,r,0,start,got,gote);
+
+ x=((long)got-p);
+ }
+ if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) x|=1;
+ x-=4; /*FIXME maybe drop 4 and add_val below*/
+ x=((long)x>>1);
+ store_val(where,MASK(11),x>>11);
+ store_val(where,MASK(11)<<16,(x&0x7ff)<<16);
+ }
+ break;
+ case R_ARM_THM_MOVW_ABS_NC:
+ s+=a;
+ if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1;
+ s&=0xffff;
+ s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
+ add_vals(where,~0L,s);
+ break;
+ case R_ARM_THM_MOVW_ABS:
+ s+=a;
+ s>>=16;
+ s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
+ add_vals(where,~0L,s);
+ break;
+ case R_ARM_ABS32:
+ add_vals(where,~0L,s+a);
+ break;
--- /dev/null
+++ gcl-2.6.12/h/elf32_armhf_reloc_special.h
@@ -0,0 +1,85 @@
+static int tramp[]={0x0c00f240, /*movw r12, #0*/
+ 0x0c00f2c0, /*movt r12, #0*/
+ 0xbf004760}; /*bx r12 nop*/
+static ul tz=sizeof(tramp)/sizeof(ul);
+
+static ul *
+next_plt_entry(ul *p,ul *pe) {
+
+ ul l0=0xe5bef000,/*ldr pc,[ip,#]*/
+ l1=0xe5bcf000;/*ldr pc,[lr,#]*/
+
+ for (;p<pe && (*p&l0)!=l0 && (*p&l1)!=l1;p++);
+ if ((*p&l0)==l0) p++;
+
+ return p+1;
+
+}
+
+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,*psec;
+ Rel *r;
+ ul *p,*pe;
+ void *ve;
+
+ /*plt entries are not of uniform size*/
+
+ massert(psec=get_section(".plt",sec1,sece,sn));
+ p=(void *)psec->sh_addr;
+ pe=(void *)p+psec->sh_size;
+
+ massert((sec=get_section( ".rel.plt",sec1,sece,sn)) ||
+ (sec=get_section(".rela.plt",sec1,sece,sn)));
+
+ v+=sec->sh_offset;
+ ve=v+sec->sh_size;
+
+ p=next_plt_entry(p,pe);/*plt0*/
+
+ for (r=v;v<ve && p<pe;v+=sec->sh_entsize,r=v,p=next_plt_entry(p,pe)) {
+ if (!ds1[ELF_R_SYM(r->r_info)].st_value)
+ ds1[ELF_R_SYM(r->r_info)].st_value=(ul)p;
+ }
+
+ massert(p==pe);
+ massert(v==ve);
+
+ 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;sym<syme;sym++)
+ sym->st_size=0;
+
+ for (*gs=0,sec=sec1;sec<sece;sec++)
+ if (sec->sh_type==SHT_REL)
+ for (v=v1+sec->sh_offset,ve=v+sec->sh_size,r=v;v<ve;v+=sec->sh_entsize,r=v)
+ if (
+#define R_ARM_THM_CALL 10
+ ELF_R_TYPE(r->r_info)==R_ARM_THM_CALL ||
+ ELF_R_TYPE(r->r_info)==R_ARM_THM_JUMP24
+ ) {
+
+ sym=sym1+ELF_R_SYM(r->r_info);
+
+ if (!sym->st_size)
+ sym->st_size=++*gs;
+
+ }
+
+ (*gs)*=tz;
+
+ return 0;
+
+}
--- gcl-2.6.12.orig/makedefc.in
+++ gcl-2.6.12/makedefc.in
@@ -6,10 +6,6 @@
# for main link of raw_gcl
LIBS=@LIBS@
-#The multi precision library stuff
-MPFILES=$(MPDIR)/@MPI_FILE@ $(MPDIR)/libmport.a
-
-
# root for the installation, eg /usr/local
# This would cause make install to create /usr/local/bin/gcl and
# /usr/local/lib/gcl-2-??/* with some basic files.
--- gcl-2.6.12.orig/o/unexelf.c
+++ gcl-2.6.12/o/unexelf.c
@@ -887,7 +887,7 @@ unexec (char *new_name, char *old_name,
/* Walk through all section headers, insert the new data2 section right
before the new bss section. */
- for (n = 1, nn = 1; n < (int) old_file_h->e_shnum; n++, nn++)
+ for (n = 0, nn = 0; n < (int) old_file_h->e_shnum; n++, nn++)
{
caddr_t src;
/* If it is (s)bss section, insert the new data2 section before it. */