enable_dynsysgmp
with_x
enable_xdr
+enable_cstackmax
enable_immfix
enable_fastimmfix
enable_ansi
--enable-gprof builds gcl with -pg in CFLAGS to enable profiling with gprof
--enable-dynsysgmp will link against the system libgmp3 overriding certain functions with patched versions from the local source
--enable-xdr=yes will compile in support for XDR
+ --enable-cstackmax=xxxx will ensure that the cstack begins below xxxx or fail
--enable-immfix will enable an immediate fixnum table above the C stack
--enable-fastimmfix=XXXX will reject low immediate fixnums unless 2^XXX can be attained
--enable-ansi builds a large gcl aiming for ansi compliance
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*)
+
+$as_echo "#define SET_STACK_POINTER \"mov %%sp,%0\\n\\t\"" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to set stack pointer" >&5
+$as_echo_n "checking how to set stack pointer... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
assert_arg_to_cflags -fdollars-in-identifiers
assert_arg_to_cflags -g #?
;;
#include <stdio.h>
#include <stdlib.h>
-
- unsigned long w;
-
- void
- foo(void) {
- int i;
- w=(unsigned long)&i;
- }
-
- int
- main(int argc,char **argv,char **envp) {
- void *b;
+ int main(int argc,char **argv,char **envp) {
FILE *fp = fopen("conftest1","w");
#ifdef CAN_UNRANDOMIZE_SBRK
#include "h/unrandomize.h"
#endif
- foo();
- fprintf(fp,"%d",((unsigned long) &b) > w ? -1 : 1);
+ fprintf(fp,"%d",(alloca(sizeof(void *))>alloca(sizeof(void *))) ? -1 : 1);
fclose(fp);
return 0;
}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cstack_direction" >&5
$as_echo "$cstack_direction" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking finding CSTACK_ALIGNMENT" >&5
+$as_echo_n "checking finding CSTACK_ALIGNMENT... " >&6; }
+if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ int main(int argc,char **argv,char **envp) {
+ void *b,*c;
+ FILE *fp = fopen("conftest1","w");
+ long n;
+ #ifdef CAN_UNRANDOMIZE_SBRK
+ #include "h/unrandomize.h"
+ #endif
+ b=alloca(sizeof(b));
+ c=alloca(sizeof(c));
+ n=b>c ? b-c : c-b;
+ n=n>sizeof(c) ? n : 1;
+ fprintf(fp,"%ld",n);
+ fclose(fp);
+ return 0;
+ }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ cstack_alignment=`cat conftest1`
+else
+ cstack_alignment=0
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define CSTACK_ALIGNMENT $cstack_alignment
+_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cstack_alignment" >&5
+$as_echo "$cstack_alignment" >&6; }
+
+# Check whether --enable-cstackmax was given.
+if test "${enable_cstackmax+set}" = set; then :
+ enableval=$enable_cstackmax; if test "$enableval" != "" ; then
+cat >>confdefs.h <<_ACEOF
+#define CSTACKMAX $enableval
+_ACEOF
+ fi
+fi
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CSTACK_ADDRESS" >&5
$as_echo_n "checking CSTACK_ADDRESS... " >&6; }
#include <stdlib.h>
int
main(int argc,char **argv,char **envp) {
- void *v ;
FILE *fp = fopen("conftest1","w");
unsigned long i,j;
j=1;
j<<=$PAGEWIDTH;
j<<=16;
- i=(unsigned long)&v;
+ i=(unsigned long)alloca(sizeof(void *));
if ($cstack_direction==1) i-=j;
j--;
i+=j;
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking finding CSTACK_ALIGNMENT" >&5
-$as_echo_n "checking finding CSTACK_ALIGNMENT... " >&6; }
-if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc,char **argv,char **envp) {
- void *b,*c;
- FILE *fp = fopen("conftest1","w");
- long n;
- #ifdef CAN_UNRANDOMIZE_SBRK
- #include "h/unrandomize.h"
- #endif
- b=alloca(sizeof(b));
- c=alloca(sizeof(c));
- n=b>c ? b-c : c-b;
- n=n>sizeof(c) ? n : 1;
- fprintf(fp,"%ld",n);
- fclose(fp);
- return 0;
- }
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- cstack_alignment=`cat conftest1`
-else
- cstack_alignment=0
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define CSTACK_ALIGNMENT $cstack_alignment
-_ACEOF
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cstack_alignment" >&5
-$as_echo "$cstack_alignment" >&6; }
-
# Check whether --enable-immfix was given.
if test "${enable_immfix+set}" = set; then :
enableval=$enable_immfix;
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*)
+ AC_DEFINE([SET_STACK_POINTER],["mov %%sp,%0\n\t"],[asm string to set the stack pointer])
+ AC_MSG_CHECKING([how to set stack pointer])
+ AC_MSG_RESULT([done])
assert_arg_to_cflags -fdollars-in-identifiers
assert_arg_to_cflags -g #?
;;
[[
#include <stdio.h>
#include <stdlib.h>
-
- unsigned long w;
-
- void
- foo(void) {
- int i;
- w=(unsigned long)&i;
- }
-
- int
- main(int argc,char **argv,char **envp) {
- void *b;
+ int main(int argc,char **argv,char **envp) {
FILE *fp = fopen("conftest1","w");
#ifdef CAN_UNRANDOMIZE_SBRK
#include "h/unrandomize.h"
#endif
- foo();
- fprintf(fp,"%d",((unsigned long) &b) > w ? -1 : 1);
+ fprintf(fp,"%d",(alloca(sizeof(void *))>alloca(sizeof(void *))) ? -1 : 1);
fclose(fp);
return 0;
}]])],
AC_DEFINE_UNQUOTED(CSTACK_DIRECTION,$cstack_direction,[whether C stack grows up or down])
AC_MSG_RESULT($cstack_direction)
+AC_MSG_CHECKING([finding CSTACK_ALIGNMENT])
+AC_RUN_IFELSE(
+ [AC_LANG_SOURCE(
+ [[
+ #include <stdio.h>
+ #include <stdlib.h>
+ int main(int argc,char **argv,char **envp) {
+ void *b,*c;
+ FILE *fp = fopen("conftest1","w");
+ long n;
+ #ifdef CAN_UNRANDOMIZE_SBRK
+ #include "h/unrandomize.h"
+ #endif
+ b=alloca(sizeof(b));
+ c=alloca(sizeof(c));
+ n=b>c ? b-c : c-b;
+ n=n>sizeof(c) ? n : 1;
+ fprintf(fp,"%ld",n);
+ fclose(fp);
+ return 0;
+ }]])],
+ [cstack_alignment=`cat conftest1`],[cstack_alignment=0])
+AC_DEFINE_UNQUOTED(CSTACK_ALIGNMENT,$cstack_alignment,[C stack alignment])
+AC_MSG_RESULT($cstack_alignment)
+
+AC_ARG_ENABLE([cstackmax],[ --enable-cstackmax=xxxx will ensure that the cstack begins below xxxx or fail],
+ [if test "$enableval" != "" ; then AC_DEFINE_UNQUOTED([CSTACKMAX],$enableval,[cstack max]) fi])
+
AC_MSG_CHECKING(CSTACK_ADDRESS)
AC_RUN_IFELSE(
#include <stdlib.h>
int
main(int argc,char **argv,char **envp) {
- void *v ;
FILE *fp = fopen("conftest1","w");
unsigned long i,j;
j=1;
j<<=$PAGEWIDTH;
j<<=16;
- i=(unsigned long)&v;
+ i=(unsigned long)alloca(sizeof(void *));
if ($cstack_direction==1) i-=j;
j--;
i+=j;
[AC_MSG_RESULT(no)
neg_cstack_address=0])
-AC_MSG_CHECKING([finding CSTACK_ALIGNMENT])
-AC_RUN_IFELSE(
- [AC_LANG_SOURCE(
- [[
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc,char **argv,char **envp) {
- void *b,*c;
- FILE *fp = fopen("conftest1","w");
- long n;
- #ifdef CAN_UNRANDOMIZE_SBRK
- #include "h/unrandomize.h"
- #endif
- b=alloca(sizeof(b));
- c=alloca(sizeof(c));
- n=b>c ? b-c : c-b;
- n=n>sizeof(c) ? n : 1;
- fprintf(fp,"%ld",n);
- fclose(fp);
- return 0;
- }]])],
- [cstack_alignment=`cat conftest1`],[cstack_alignment=0])
-AC_DEFINE_UNQUOTED(CSTACK_ALIGNMENT,$cstack_alignment,[C stack alignment])
-AC_MSG_RESULT($cstack_alignment)
-
AC_ARG_ENABLE([immfix],[ --enable-immfix will enable an immediate fixnum table above the C stack])
AC_ARG_ENABLE([fastimmfix],[ --enable-fastimmfix=XXXX will reject low immediate fixnums unless 2^XXX can be attained],,[enable_fastimmfix=64])
/* main.c */
EXTER char* system_directory;
-EXTER int ARGC;
-EXTER char **ARGV;
void error();
-#ifdef UNIX
-EXTER char **ENVP;
-#endif
object vs_overflow(void);
EXTER object sSAsystem_directoryA;
case R_ARM_THM_JUMP24:
{
long x=(long)(s+a-p);
- if (abs(x)&(~MASK(22))) {
+ if (abs(x)&(~MASK(23))) {
got+=(sym->st_size-1)*tz;
memcpy(got,tramp,sizeof(tramp));
*/
#undef CRAY_STACKSEG_END
+/* cstack max */
+#undef CSTACKMAX
+
/* starting C stack address */
#undef CSTACK_ADDRESS
/* system pagewidth */
#undef PAGEWIDTH
+/* asm string to set the stack pointer */
+#undef SET_STACK_POINTER
+
/* have sigcontext of signal.h */
#undef SIGNAL_H_HAS_SIGCONTEXT
#include <sys/personality.h>
+#include <sys/mman.h>
#include <syscall.h>
#include <unistd.h>
#include <string.h>
exit(-1);
}
}
+#if defined(CSTACKMAX) && CSTACK_DIRECTION < 0
+ if ((void *)&argc > (void *)CSTACKMAX) {
+ if (mmap((void *)CSTACKMAX-(1L << PAGEWIDTH),(1L << PAGEWIDTH),
+ PROT_READ|PROT_WRITE|PROT_EXEC,MAP_FIXED|MAP_PRIVATE|MAP_ANON|MAP_STACK|MAP_GROWSDOWN,-1,0)==(void *)-1) {
+ printf("cannot mmap new stack %d\n",errno);
+ exit(-1);
+ }
+#ifdef SET_STACK_POINTER
+ {void *p=(void *)CSTACKMAX-4*CSTACK_ALIGNMENT;asm volatile (SET_STACK_POINTER::"r" (p):"memory");}
+#else
+#error Cannot set stack pointer
+#endif
+ }
+#endif
+
}
}
#endif
+static int ARGC;
+static char **ARGV;
+
int
main(int argc, char **argv, char **envp) {
#include "unrandomize.h"
#endif
- gcl_init_alloc(&argv);
+ gcl_init_alloc(alloca(1));
setbuf(stdin, stdin_buf);
setbuf(stdout, stdout_buf);
#endif
ARGC = argc;
ARGV = argv;
- ENVP = envp;
vs_top = vs_base = vs_org;
ihs_top = ihs_org-1;
printf("GCL (GNU Common Lisp) %s %ld pages\n",LISP_IMPLEMENTATION_VERSION,real_maxpage);
fflush(stdout);
- if (argc>1) {
- massert(argv[1][strlen(argv[1])-1]=='/');
- system_directory=argv[1];
+ if (ARGC>1) {
+ massert(ARGV[1][strlen(ARGV[1])-1]=='/');
+ system_directory=ARGV[1];
}
initlisp();