summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamm Maguire <camm@debian.org>2014-04-16 14:17:25 +0000
committerCamm Maguire <camm@debian.org>2014-04-21 15:03:24 +0000
commit10aa5cf30b20075fae1655d63f1936816eea3e57 (patch)
tree720936c3a20cb67718a46dd015d1be94d7b869ba
parentec06c26b14101f1fa244c9a70883a5f4d2ff1852 (diff)
downloadgcl-10aa5cf30b20075fae1655d63f1936816eea3e57.tar.gz
cleanup sigaltstack code and macros
-rwxr-xr-xgcl/h/386-bsd.h4
-rw-r--r--gcl/h/386-macosx.h19
-rwxr-xr-xgcl/h/FreeBSD.h17
-rwxr-xr-xgcl/h/NetBSD.h22
-rwxr-xr-xgcl/h/OpenBSD.h15
-rwxr-xr-xgcl/h/gnuwin95.h1
-rwxr-xr-xgcl/h/hp300-bsd.h7
-rw-r--r--gcl/h/linux.h6
-rwxr-xr-xgcl/h/mingw.h1
-rw-r--r--gcl/h/powerpc-macosx.h16
-rw-r--r--gcl/h/protoize.h3
-rwxr-xr-xgcl/h/rios-aix3.h5
-rwxr-xr-xgcl/h/rios.h4
-rwxr-xr-xgcl/h/sun4.h8
-rw-r--r--gcl/o/alloc.c43
-rwxr-xr-xgcl/o/main.c9
16 files changed, 22 insertions, 158 deletions
diff --git a/gcl/h/386-bsd.h b/gcl/h/386-bsd.h
index 65479e45..9ea9fb0d 100755
--- a/gcl/h/386-bsd.h
+++ b/gcl/h/386-bsd.h
@@ -81,10 +81,6 @@
#define DONT_NEED_MALLOC
#endif
-#define INSTALL_SEGMENTATION_CATCHER \
- (void) signal(SIGSEGV,segmentation_catcher); \
- (void) signal(SIGBUS,segmentation_catcher)
-
/* Begin for cmpinclude */
#define WANT_SGC
diff --git a/gcl/h/386-macosx.h b/gcl/h/386-macosx.h
index 37eff0d9..3b71c2ed 100644
--- a/gcl/h/386-macosx.h
+++ b/gcl/h/386-macosx.h
@@ -113,21 +113,6 @@ extern int seek_to_end_ofile (FILE *);
/* Copied from {Net,Free,Open}BSD.h */
/* Modified according to Camm's instructions on April 15, 2004. */
#define HAVE_SIGPROCMASK
-/* #define SIG_STACK_SIZE (SIGSTKSZ/sizeof(double)) */
-/* #define SIG_STACK_SIZE 1000 */
-/* #define SETUP_SIG_STACK \ */
-/* { \ */
-/* static stack_t estack; \ */
-/* static double estack_buf [SIG_STACK_SIZE]; \ */
-/* bzero(estack_buf, sizeof(estack_buf)); \ */
-/* estack.ss_sp = (char *) &estack_buf[SIG_STACK_SIZE-1]; \ */
-/* estack.ss_flags = 0; \ */
-/* estack.ss_size = SIGSTKSZ; \ */
-/* if (sigaltstack(&estack, 0) < 0) \ */
-/* perror("sigaltstack"); \ */
-/* } */
-
-#define ADVANCE_ESTACK_POINTER
/* until the sgc/save problem can be fixed. 20050114 CM*/
/* #define SGC */
@@ -144,10 +129,6 @@ do { \
sigaction (SIGSEGV, &sact, 0); \
} while (0);
-#define INSTALL_SEGMENTATION_CATCHER \
- (void) signal (SIGSEGV, segmentation_catcher); \
- (void) signal (SIGBUS, segmentation_catcher)
-
/* si_addr not containing the faulting address is a bug in Darwin.
Work around this by looking at the dar field of the exception state. */
#define GET_FAULT_ADDR(sig,code,sv,a) ((siginfo_t *)code)->si_addr
diff --git a/gcl/h/FreeBSD.h b/gcl/h/FreeBSD.h
index 62662624..7ab9db9a 100755
--- a/gcl/h/FreeBSD.h
+++ b/gcl/h/FreeBSD.h
@@ -79,23 +79,6 @@ do { \
#define HAVE_SIGPROCMASK
#define SIG_STACK_SIZE (SIGSTKSZ/sizeof(double))
-#undef SETUP_SIG_STACK
-#define SETUP_SIG_STACK { \
- static struct sigaltstack estack; \
- if (estack.ss_sp == NULL && \
- (estack.ss_sp = malloc(SIGSTKSZ)) == NULL) \
- perror("malloc"); \
- estack.ss_size = SIGSTKSZ; \
- estack.ss_flags = 0; \
- if (sigaltstack(&estack, 0) < 0) \
- perror("sigaltstack"); \
-}
-
-#undef INSTALL_SEGMENTATION_CATCHER
-#define INSTALL_SEGMENTATION_CATCHER \
- (void) gcl_signal(SIGSEGV, segmentation_catcher); \
- (void) gcl_signal(SIGBUS, segmentation_catcher)
-
/*
* The next two defines are for SGC,
* one of which needs to go in cmpinclude.h.
diff --git a/gcl/h/NetBSD.h b/gcl/h/NetBSD.h
index c9fa804f..2ba62c6b 100755
--- a/gcl/h/NetBSD.h
+++ b/gcl/h/NetBSD.h
@@ -76,18 +76,6 @@
/* end stuff for dumping and reloading */
-/* begin setup alternate signal stack */
-#define SIG_STACK_SIZE SIGSTKSZ
-#define SETUP_SIG_STACK \
-{ static struct sigaltstack estack ; \
- estack.ss_size = sizeof(estack_buf) ; \
- estack.ss_flags = 0; \
- estack.ss_base = (char *) &estack_buf[SIG_STACK_SIZE-1]; \
- if (sigaltstack(&estack, (struct sigaltstack *)0) < 0) \
- perror("sigaltstack");} \
-
-/* end setup signal stack */
-
#define HZ 60
/* begin for GC */
@@ -114,13 +102,3 @@
fflush(save);
/* end read header */
-
-#define INSTALL_SEGMENTATION_CATCHER \
- (void) signal(SIGSEGV,segmentation_catcher); \
- (void) signal(SIGBUS,segmentation_catcher)
-
-
-
-
-
-
diff --git a/gcl/h/OpenBSD.h b/gcl/h/OpenBSD.h
index f9593ca4..72560d47 100755
--- a/gcl/h/OpenBSD.h
+++ b/gcl/h/OpenBSD.h
@@ -59,21 +59,6 @@
#define PAGEWIDTH 12 /* i386 sees 4096 byte pages */
/* end for GC */
-#define SIG_STACK_SIZE (SIGSTKSZ/sizeof(double))
-#define SETUP_SIG_STACK \
-{ \
- static struct sigaltstack estack; \
- estack.ss_sp = estack_buf; \
- estack.ss_size = SIGSTKSZ; \
- estack.ss_flags = 0; \
- if (sigaltstack(&estack, 0) < 0) \
- perror("sigaltstack"); \
-}
-
-#define INSTALL_SEGMENTATION_CATCHER \
- (void) gcl_signal(SIGSEGV, segmentation_catcher); \
- (void) gcl_signal(SIGBUS, segmentation_catcher)
-
/*
* The next two defines are for SGC,
* one of which needs to go in cmpinclude.h.
diff --git a/gcl/h/gnuwin95.h b/gcl/h/gnuwin95.h
index 864aed60..7badd313 100755
--- a/gcl/h/gnuwin95.h
+++ b/gcl/h/gnuwin95.h
@@ -50,7 +50,6 @@ extern DBEGIN_TY _dbegin;
#define HAVE_SIGACTION
/* a noop */
-#define SETUP_SIG_STACK
#define SA_ONSTACK 0
#define brk(x) printf("not doing break\n");
diff --git a/gcl/h/hp300-bsd.h b/gcl/h/hp300-bsd.h
index 6a75e781..c53d861d 100755
--- a/gcl/h/hp300-bsd.h
+++ b/gcl/h/hp300-bsd.h
@@ -47,13 +47,6 @@
*/
#define GET_FAULT_ADDR(sig,code,sv,a) ((char *) code)
-#define INSTALL_SEGMENTATION_CATCHER \
- (void) signal(SIGSEGV,segmentation_catcher); \
- (void) signal(SIGBUS,segmentation_catcher)
-
-
-
-
/* Begin for cmpinclude */
diff --git a/gcl/h/linux.h b/gcl/h/linux.h
index 022d0bc1..c96214d7 100644
--- a/gcl/h/linux.h
+++ b/gcl/h/linux.h
@@ -78,7 +78,6 @@ do {static struct sigaction action; \
#undef HAVE_SIGVEC
#define HAVE_SIGACTION
-/* make this a noop */
#ifndef HAVE_SV_ONSTACK
#define SV_ONSTACK 0
#endif
@@ -124,11 +123,6 @@ do { int c = 0; \
#define GETPATHNAME
#define PATHNAME_CACHE 10
-
-#define INSTALL_SEGMENTATION_CATCHER \
- (void) gcl_signal(SIGSEGV,segmentation_catcher)
-
-
/* get the fileno of a FILE* */
#define FILENO(x) fileno(x)
diff --git a/gcl/h/mingw.h b/gcl/h/mingw.h
index bf7bb387..b773d55d 100755
--- a/gcl/h/mingw.h
+++ b/gcl/h/mingw.h
@@ -102,7 +102,6 @@ extern DBEGIN_TY _stacktop, _stackbottom, _dbegin;
#define NEED_TO_REINSTALL_SIGNALS
/*#define HAVE_SIGACTION*/
-#define SETUP_SIG_STACK
#define SV_ONSTACK 0
#define SA_RESTART 0
diff --git a/gcl/h/powerpc-macosx.h b/gcl/h/powerpc-macosx.h
index 0ac826ec..31b972ac 100644
--- a/gcl/h/powerpc-macosx.h
+++ b/gcl/h/powerpc-macosx.h
@@ -98,18 +98,6 @@ do {
/* Copied from {Net,Free,Open}BSD.h */
/* Modified according to Camm's instructions on April 15, 2004. */
#define HAVE_SIGPROCMASK
-/* #define SIG_STACK_SIZE (SIGSTKSZ/sizeof(double)) */
-#define SETUP_SIG_STACK \
-{ \
-static struct sigaltstack estack; \
-static double estack_buf [SIG_STACK_SIZE]; \
-bzero(estack_buf, sizeof(estack_buf)); \
-estack.ss_sp = (char *) &estack_buf[SIG_STACK_SIZE-1]; \
-estack.ss_flags = 0; \
-estack.ss_size = SIGSTKSZ; \
-if (sigaltstack(&estack, 0) < 0) \
- perror("sigaltstack"); \
-}
/* until the sgc/save problem can be fixed. 20050114 CM*/
/* #define SGC */
@@ -126,10 +114,6 @@ do { \
sigaction (SIGSEGV, &sact, 0); \
} while (0);
-#define INSTALL_SEGMENTATION_CATCHER \
- (void) signal (SIGSEGV, segmentation_catcher); \
- (void) signal (SIGBUS, segmentation_catcher)
-
/* si_addr not containing the faulting address is a bug in Darwin.
Work around this by looking at the dar field of the exception state. */
#define GET_FAULT_ADDR(sig,code,scp,addr) ((char *) (((ucontext_t *) scp)->uc_mcontext->es.dar))
diff --git a/gcl/h/protoize.h b/gcl/h/protoize.h
index 0191ff8c..e43ad034 100644
--- a/gcl/h/protoize.h
+++ b/gcl/h/protoize.h
@@ -1836,3 +1836,6 @@ object
number_dpf(object,object,object);
extern void *feval_src;
+#if defined(DARWIN)
+void init_darwin_zone_compat ();
+#endif
diff --git a/gcl/h/rios-aix3.h b/gcl/h/rios-aix3.h
index 3ba7ef29..dcbe6fa5 100755
--- a/gcl/h/rios-aix3.h
+++ b/gcl/h/rios-aix3.h
@@ -225,11 +225,6 @@ for the kernel. See aix3_mprotect directory.
#undef VSSIZE
#define VSSIZE 81520
-
-#define INSTALL_SEGMENTATION_CATCHER \
- sigstack(&estack,0); \
- (void) gcl_signal(SIGSEGV,segmentation_catcher);
-
#if defined(IN_SOCKETS) || defined(IN_GUIS)
#include <sys/select.h>
#undef bzero
diff --git a/gcl/h/rios.h b/gcl/h/rios.h
index 57037e9d..15096e52 100755
--- a/gcl/h/rios.h
+++ b/gcl/h/rios.h
@@ -235,10 +235,6 @@ for the kernel. See aix3_mprotect directory.
#define VSSIZE 81520
-#define INSTALL_SEGMENTATION_CATCHER \
- sigstack(&estack,0); \
- (void) gcl_signal(SIGSEGV,segmentation_catcher);
-
#if defined(IN_SOCKETS) || defined(IN_GUIS)
#include <sys/select.h>
#undef bzero
diff --git a/gcl/h/sun4.h b/gcl/h/sun4.h
index f47d2439..e5cfe42b 100755
--- a/gcl/h/sun4.h
+++ b/gcl/h/sun4.h
@@ -22,14 +22,6 @@
#define GET_FAULT_ADDR(sig,code,scp,addr) \
(code ? ((siginfo_t *)code )->si_addr : error("no address info"))
-#define SETUP_SIG_STACK \
-{ static stack_t estack ; \
- estack.ss_size = sizeof(estack_buf) ; \
- estack.ss_flags = 0; \
- estack.ss_sp = (char *) &estack_buf[SIG_STACK_SIZE-1]; \
- if (sigaltstack(&estack, (stack_t *)0) < 0) \
- perror("sigaltstack");} \
-
#undef HAVE_AOUT
#define HAVE_AOUT <elf.h>
#define HAVE_ELF
diff --git a/gcl/o/alloc.c b/gcl/o/alloc.c
index 72357656..2edba695 100644
--- a/gcl/o/alloc.c
+++ b/gcl/o/alloc.c
@@ -1031,36 +1031,27 @@ gcl_init_alloc(void *cs_start) {
cs_limit = cs_org + CSTACK_DIRECTION*cssize;
#ifdef __ia64__
- {
- extern void * __libc_ia64_register_backing_store_base;
- cs_org2=cs_base2=__libc_ia64_register_backing_store_base;
- }
+ {
+ extern void * __libc_ia64_register_backing_store_base;
+ cs_org2=cs_base2=__libc_ia64_register_backing_store_base;
+ }
#endif
-
-#ifdef SETUP_SIG_STACK
- SETUP_SIG_STACK
-#else
+
#if defined(HAVE_SIGACTION) || defined(HAVE_SIGVEC)
- {
- /* make sure the stack is 8 byte aligned */
- static double estack_buf[32*SIGSTKSZ];
- static struct sigaltstack estack;
-
- bzero(estack_buf,sizeof(estack_buf));
- estack.ss_sp = estack_buf;
-#ifdef ADVANCE_ESTACK_POINTER
- estack.ss_sp+=sizeof(estack_buf)-sizeof(*estack_buf);
-#endif
- estack.ss_flags = 0;
- estack.ss_size = sizeof(estack_buf);
- massert(sigaltstack(&estack, 0)>=0);
-
- }
-#endif
+ {
+ /* make sure the stack is 8 byte aligned */
+ static double estack_buf[32*SIGSTKSZ];
+ static stack_t estack;
+
+ estack.ss_sp = estack_buf;
+ estack.ss_flags = 0;
+ estack.ss_size = sizeof(estack_buf);
+ massert(sigaltstack(&estack, 0)>=0);
+ }
#endif
-
+
install_segmentation_catcher();
-
+
#ifdef SGC
massert(getpagesize()<=PAGESIZE);
diff --git a/gcl/o/main.c b/gcl/o/main.c
index ac49d7c7..a1398ac9 100755
--- a/gcl/o/main.c
+++ b/gcl/o/main.c
@@ -393,13 +393,8 @@ main(int argc, char **argv, char **envp) {
/* catch certain signals */
void install_segmentation_catcher(void)
{
-#ifdef INSTALL_SEGMENTATION_CATCHER
- INSTALL_SEGMENTATION_CATCHER;
-#else
-#ifdef SIGSEGV
- (void) gcl_signal(SIGSEGV,segmentation_catcher);
-#endif
-#endif
+ (void) gcl_signal(SIGSEGV,segmentation_catcher);
+ (void) gcl_signal(SIGBUS,segmentation_catcher);
}
int catch_fatal=1;