#include <stdio.h>
#define EXTER
+ #define INLINE
#include "$MP_INCLUDE"
#include "./h/enum.h"
#define OBJ_ALIGN
/* end confdefs.h. */
#include <stdio.h>
#define EXTER
+ #define INLINE
#include "$MP_INCLUDE"
#include "h/enum.h"
#include "h/type.h"
/* end confdefs.h. */
#include <stdio.h>
#define EXTER
+ #define INLINE
#include "$MP_INCLUDE"
#include "`pwd`/h/enum.h"
#include "`pwd`/h/type.h"
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#define EXTER
+ #define INLINE
#include "$MP_INCLUDE"
#include "./h/enum.h"
#define OBJ_ALIGN
if test "$use" = "mingw" ; then
AC_TRY_RUN([#include <stdio.h>
#define EXTER
+ #define INLINE
#include "$MP_INCLUDE"
#include "h/enum.h"
#include "h/type.h"
else
AC_TRY_RUN([#include <stdio.h>
#define EXTER
+ #define INLINE
#include "$MP_INCLUDE"
#include "`pwd`/h/enum.h"
#include "`pwd`/h/type.h"
#define IMMNUM_H
#define GMP_WRAPPERS_H
#define ERROR_H
+#undef INLINE
#include "include.h"
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<ggote) {
+ massert(!write_stub(s,got,gote));
+ } else
+ *gote=s+(a&~MASK(16))+((a&0x8000)<<1);
break;
case R_MIPS_GOT_OFST:
store_val(where,MASK(16),a);
-static Rela *hr;
+static ul ggot,ggote; static Rela *hr;
#undef ELF_R_SYM
#define ELF_R_SYM(a_) (a_&0xffffffff)
#define ELF_R_TYPE(a_) (((a_>>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->address<ggote)
+ (*gs)+=3;
+
+ return 0;
+
+}
+
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;
+ ul *q,gotsym=0,locgotno=0,stub,stube;
+ void *p,*pe;
+
+ massert(sec=get_section(".dynamic",sec1,sece,sn));
+ for (p=(void *)sec->sh_addr,pe=p+sec->sh_size;p<pe;p+=sec->sh_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;sym<dse;sym++)
+ if (!sym->st_value || (sym->st_value>=stub && sym->st_value<stube))
+ sym->st_value=ggot+(sym-ds1)*sec->sh_entsize;
+
return 0;
}
sym->st_size|=(q<<(a*16));
}
+ massert(!make_got_room_for_stub(sec1,sece,sym,st1,gs));
+
}
b=sizeof(r->r_addend)*4;
#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
+
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) {
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
ZERO_BIG(x);
}
-
#ifndef HAVE_MP_COERCE_TO_STRING
double digitsPerBit[37]={ 0,0,
#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;
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();
}
#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) {
*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)
#-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)