From 108e2570c04f011e3235dcbde8186d60568c1ad1 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-17) unstable; urgency=medium * Version_2_6_13pre20 Gbp-Pq: Name Version_2_6_13pre22 --- configure | 3 ++ configure.in | 3 ++ gcl-tk/guis.h | 1 + h/elf64_mips_reloc.h | 5 ++- h/elf64_mips_reloc_special.h | 61 +++++++++++++++++++++++++++++++++++- h/notcomp.h | 10 ++++++ h/object.h | 6 +--- o/big.c | 27 +++++++++++++++- o/gmp_big.c | 21 ------------- o/main.c | 4 +-- o/num_rand.c | 28 ----------------- unixport/sys_init.lsp.in | 5 ++- 12 files changed, 111 insertions(+), 63 deletions(-) diff --git a/configure b/configure index 718baf2..9b7e318 100755 --- a/configure +++ b/configure @@ -6553,6 +6553,7 @@ else #include #define EXTER + #define INLINE #include "$MP_INCLUDE" #include "./h/enum.h" #define OBJ_ALIGN @@ -6681,6 +6682,7 @@ else /* end confdefs.h. */ #include #define EXTER + #define INLINE #include "$MP_INCLUDE" #include "h/enum.h" #include "h/type.h" @@ -6710,6 +6712,7 @@ else /* end confdefs.h. */ #include #define EXTER + #define INLINE #include "$MP_INCLUDE" #include "`pwd`/h/enum.h" #include "`pwd`/h/type.h" diff --git a/configure.in b/configure.in index 56e8ac5..d81e9fd 100644 --- a/configure.in +++ b/configure.in @@ -1301,6 +1301,7 @@ AC_MSG_CHECKING([for required object alignment]) AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #define EXTER + #define INLINE #include "$MP_INCLUDE" #include "./h/enum.h" #define OBJ_ALIGN @@ -1341,6 +1342,7 @@ AC_MSG_CHECKING(sizeof struct contblock) if test "$use" = "mingw" ; then AC_TRY_RUN([#include #define EXTER + #define INLINE #include "$MP_INCLUDE" #include "h/enum.h" #include "h/type.h" @@ -1357,6 +1359,7 @@ AC_TRY_RUN([#include else AC_TRY_RUN([#include #define EXTER + #define INLINE #include "$MP_INCLUDE" #include "`pwd`/h/enum.h" #include "`pwd`/h/type.h" diff --git a/gcl-tk/guis.h b/gcl-tk/guis.h index 2c849f6..0d69247 100755 --- a/gcl-tk/guis.h +++ b/gcl-tk/guis.h @@ -7,6 +7,7 @@ #define IMMNUM_H #define GMP_WRAPPERS_H #define ERROR_H +#undef INLINE #include "include.h" diff --git a/h/elf64_mips_reloc.h b/h/elf64_mips_reloc.h index 5848cdb..f2ae317 100644 --- a/h/elf64_mips_reloc.h +++ b/h/elf64_mips_reloc.h @@ -15,7 +15,10 @@ gote=got+(a>>32)-1; a&=MASK(32); store_val(where,MASK(16),((void *)gote-(void *)got)); - *gote=s+(a&~MASK(16))+((a&0x8000)<<1); + if (s>=ggot && s>40)&0xff) ? ((a_>>40)&0xff) : ((a_>>56)&0xff)) #define ELF_R_FTYPE(a_) ((a_>>56)&0xff) +static int +write_stub(ul s,ul *got,ul *gote) { + + int *goti; + + *gote=(ul)(goti=(void *)(gote+2)); + *++gote=s; + s=((void *)gote-(void *)got); + *goti++=(0x37<<26)|(0x1c<<21)|(0x19<<16)|s; + *goti++=(0x37<<26)|(0x19<<21)|(0x19<<16)|0; + *goti++=0x03200008; + *goti++=0x00200825; + + return 0; + +} + +static int +make_got_room_for_stub(Shdr *sec1,Shdr *sece,Sym *sym,const char *st1,ul *gs) { + + Shdr *ssec=sec1+sym->st_shndx; + struct node *a; + if ((ssec>=sece || !ALLOC_SEC(ssec)) && + (a=find_sym_ptable(st1+sym->st_name)) && + a->address>=ggot && a->addresssh_addr,pe=p+sec->sh_size;psh_entsize) { + q=p; + if (q[0]==DT_MIPS_GOTSYM) + gotsym=q[1]; + if (q[0]==DT_MIPS_LOCAL_GOTNO) + locgotno=q[1]; + } + massert(gotsym && locgotno); + + massert(sec=get_section(".MIPS.stubs",sec1,sece,sn)); + stub=sec->sh_addr; + stube=sec->sh_addr+sec->sh_size; + + massert(sec=get_section(".got",sec1,sece,sn)); + ggot=sec->sh_addr+locgotno*sec->sh_entsize; + ggote=sec->sh_addr+sec->sh_size; + + for (ds1+=gotsym,sym=ds1;symst_value || (sym->st_value>=stub && sym->st_valuest_value=ggot+(sym-ds1)*sec->sh_entsize; + return 0; } @@ -45,6 +102,8 @@ label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char sym->st_size|=(q<<(a*16)); } + massert(!make_got_room_for_stub(sec1,sece,sym,st1,gs)); + } b=sizeof(r->r_addend)*4; diff --git a/h/notcomp.h b/h/notcomp.h index f7e4bc8..71e8018 100755 --- a/h/notcomp.h +++ b/h/notcomp.h @@ -364,3 +364,13 @@ extern bool writable_malloc; #define pfork() prof_block(fork()) #include "error.h" + +#if __GNU_MP_VERSION > 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR >= 2) +extern void __gmp_randget_mt (); +extern void __gmp_randclear_mt (); +extern void __gmp_randiset_mt (); + +typedef struct {void *a,*b,*c,*d;} gmp_randfnptr_t; +EXTER gmp_randfnptr_t Mersenne_Twister_Generator_Noseed; +#endif + diff --git a/h/object.h b/h/object.h index 6937bc3..f7cfa9f 100755 --- a/h/object.h +++ b/h/object.h @@ -349,11 +349,7 @@ EXTER char *new_rb_start; /* desired relblock start after next gc */ EXTER char *rb_start; /* relblock start */ EXTER char *rb_end; /* relblock end */ EXTER char *rb_limit; /* relblock limit */ -EXTER char *rb_pointer; /* relblock pointer */ - -#ifndef INLINE -#define INLINE -#endif +EXTER char *rb_pointer; /* relblock pointer */ INLINE ufixnum rb_size(void) { diff --git a/o/big.c b/o/big.c index d66a002..0d1b4b9 100755 --- a/o/big.c +++ b/o/big.c @@ -70,6 +70,32 @@ DEFUN_NEW("SET-GMP-ALLOCATE-RELOCATABLE",object,fSset_gmp_allocate_relocatable,S RETURN1(flag); } +#ifndef GMP_USE_MALLOC +object big_gcprotect; +object big_fixnum1; + +#include "gmp.c" + +void +gcl_init_big1(void) { + + mp_set_memory_functions( gcl_gmp_alloc,gcl_gmp_realloc,gcl_gmp_free); + jmp_gmp=0; + +#if __GNU_MP_VERSION > 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR >= 2) + Mersenne_Twister_Generator_Noseed.b=__gmp_randget_mt; + Mersenne_Twister_Generator_Noseed.c=__gmp_randclear_mt; + Mersenne_Twister_Generator_Noseed.d=__gmp_randiset_mt; +#endif + +} + +#else +gcl_init_big1() +{ +} +#endif + #ifdef GMP #include "gmp_big.c" #else @@ -93,7 +119,6 @@ void zero_big(object x) ZERO_BIG(x); } - #ifndef HAVE_MP_COERCE_TO_STRING double digitsPerBit[37]={ 0,0, diff --git a/o/gmp_big.c b/o/gmp_big.c index a522073..ddcb41e 100755 --- a/o/gmp_big.c +++ b/o/gmp_big.c @@ -81,27 +81,6 @@ static object verify_big_or_zero(object big) #define verify_big_or_zero(x) #endif - - - - -#ifndef GMP_USE_MALLOC -object big_gcprotect; -object big_fixnum1; - -#include "gmp.c" -void -gcl_init_big1(void) { - mp_set_memory_functions( gcl_gmp_alloc,gcl_gmp_realloc,gcl_gmp_free); - jmp_gmp=0; -} - -#else -gcl_init_big1() -{ -} -#endif - object new_bignum(void) { object ans; diff --git a/o/main.c b/o/main.c index 1d2e330..5cd142e 100755 --- a/o/main.c +++ b/o/main.c @@ -511,9 +511,7 @@ main(int argc, char **argv, char **envp) { terminal_io->sm.sm_object0->sm.sm_fp = stdin; terminal_io->sm.sm_object1->sm.sm_fp = stdout; -#ifdef LD_BIND_NOW /*FIXME currently mips only, verify that these two requirements are the same*/ - reinit_gmp(); -#endif + gcl_init_big1(); #ifdef HAVE_READLINE gcl_init_readline_function(); diff --git a/o/num_rand.c b/o/num_rand.c index cd83b20..c91e51e 100755 --- a/o/num_rand.c +++ b/o/num_rand.c @@ -104,34 +104,6 @@ trap_gcl_gmp_allocfun(size_t size){ } #endif -#if __GNU_MP_VERSION > 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR >= 2) -extern void -__gmp_randget_mt (); -extern void -__gmp_randclear_mt (); -extern void -__gmp_randiset_mt (); - -typedef struct {void *a,*b,*c,*d;} gmp_randfnptr_t; -static gmp_randfnptr_t Mersenne_Twister_Generator_Noseed = { - NULL, - __gmp_randget_mt, - __gmp_randclear_mt, - __gmp_randiset_mt -}; -#endif - -void -reinit_gmp() { - -#if __GNU_MP_VERSION > 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR >= 2) - Mersenne_Twister_Generator_Noseed.b=__gmp_randget_mt; - Mersenne_Twister_Generator_Noseed.c=__gmp_randclear_mt; - Mersenne_Twister_Generator_Noseed.d=__gmp_randiset_mt; -#endif - -} - void init_gmp_rnd_state(__gmp_randstate_struct *x) { diff --git a/unixport/sys_init.lsp.in b/unixport/sys_init.lsp.in index b3bd8c3..beb735b 100644 --- a/unixport/sys_init.lsp.in +++ b/unixport/sys_init.lsp.in @@ -66,9 +66,7 @@ *opt-two* @LI-OPT-TWO@ *init-lsp* @LI-INIT-LSP@) -(import 'si::(clines defentry defcfun object void int double - quit bye gbc system commonp - *break-on-warnings* +(import 'si::(commonp *break-on-warnings* make-char char-bits char-font char-bit set-char-bit string-char-p int-char char-font-limit char-bits-limit char-control-bit char-meta-bit char-super-bit char-hyper-bit compiler-let) :cltl1-compat) @@ -79,3 +77,4 @@ #-ansi-cl(do-symbols (s :cltl1-compat) (export s :lisp))) #+ansi-cl (use-package :pcl :user) +(import 'si::(clines defentry defcfun object void int double quit bye gbc system) :user) -- 2.30.2