aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r--gcc/ada/init.c171
1 files changed, 2 insertions, 169 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 87124b6..4db5789 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -70,7 +70,8 @@ extern "C" {
extern void __gnat_raise_program_error (const char *, int);
/* Addresses of exception data blocks for predefined exceptions. Tasking_Error
- is not used in this unit, and the abort signal is only used on IRIX. */
+ is not used in this unit, and the abort signal is only used on IRIX.
+ ??? Revisit this part since IRIX is no longer supported. */
extern struct Exception_Data constraint_error;
extern struct Exception_Data numeric_error;
extern struct Exception_Data program_error;
@@ -603,174 +604,6 @@ __gnat_install_handler (void)
__gnat_handler_installed = 1;
}
-/****************/
-/* IRIX Section */
-/****************/
-
-#elif defined (sgi)
-
-#include <signal.h>
-#include <siginfo.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define SIGADAABORT 48
-#define SIGNAL_STACK_SIZE 4096
-#define SIGNAL_STACK_ALIGNMENT 64
-
-#define Check_Abort_Status \
- system__soft_links__check_abort_status
-extern int (*Check_Abort_Status) (void);
-
-extern struct Exception_Data _abort_signal;
-
-/* We are not setting the SA_SIGINFO bit in the sigaction flags when
- connecting that handler, with the effects described in the sigaction
- man page:
-
- SA_SIGINFO If set and the signal is caught, sig is passed as the
- first argument to the signal-catching function. If the
- second argument is not equal to NULL, it points to a
- siginfo_t structure containing the reason why the
- signal was generated [see siginfo(5)]; the third
- argument points to a ucontext_t structure containing
- the receiving process's context when the signal was
- delivered [see ucontext(5)]. If cleared and the signal
- is caught, the first argument is also the signal number
- but the second argument is the signal code identifying
- the cause of the signal. The third argument points to a
- sigcontext_t structure containing the receiving
- process's context when the signal was delivered. This
- is the default behavior (see signal(5) for more
- details). Additionally, when SA_SIGINFO is set for a
- signal, multiple occurrences of that signal will be
- queued for delivery in FIFO order (see sigqueue(3) for
- a more detailed explanation of this concept), if those
- occurrences of that signal were generated using
- sigqueue(3). */
-
-static void
-__gnat_error_handler (int sig, siginfo_t *reason, void *uc ATTRIBUTE_UNUSED)
-{
- /* This handler is installed with SA_SIGINFO cleared, but there's no
- prototype for the resulting alternative three-argument form, so we
- have to hack around this by casting reason to the int actually
- passed. */
- int code = (int) reason;
- struct Exception_Data *exception;
- const char *msg;
-
- switch (sig)
- {
- case SIGSEGV:
- if (code == EFAULT)
- {
- exception = &program_error;
- msg = "SIGSEGV: (Invalid virtual address)";
- }
- else if (code == ENXIO)
- {
- exception = &program_error;
- msg = "SIGSEGV: (Read beyond mapped object)";
- }
- else if (code == ENOSPC)
- {
- exception = &program_error; /* ??? storage_error ??? */
- msg = "SIGSEGV: (Autogrow for file failed)";
- }
- else if (code == EACCES || code == EEXIST)
- {
- /* ??? We handle stack overflows here, some of which do trigger
- SIGSEGV + EEXIST on Irix 6.5 although EEXIST is not part of
- the documented valid codes for SEGV in the signal(5) man
- page. */
-
- /* ??? Re-add smarts to further verify that we launched
- the stack into a guard page, not an attempt to
- write to .text or something. */
- exception = &storage_error;
- msg = "SIGSEGV: stack overflow or erroneous memory access";
- }
- else
- {
- /* Just in case the OS guys did it to us again. Sometimes
- they fail to document all of the valid codes that are
- passed to signal handlers, just in case someone depends
- on knowing all the codes. */
- exception = &program_error;
- msg = "SIGSEGV: (Undocumented reason)";
- }
- break;
-
- case SIGBUS:
- /* Map all bus errors to Program_Error. */
- exception = &program_error;
- msg = "SIGBUS";
- break;
-
- case SIGFPE:
- /* Map all fpe errors to Constraint_Error. */
- exception = &constraint_error;
- msg = "SIGFPE";
- break;
-
- case SIGADAABORT:
- if ((*Check_Abort_Status) ())
- {
- exception = &_abort_signal;
- msg = "";
- }
- else
- return;
-
- break;
-
- default:
- /* Everything else is a Program_Error. */
- exception = &program_error;
- msg = "unhandled signal";
- }
-
- Raise_From_Signal_Handler (exception, msg);
-}
-
-void
-__gnat_install_handler (void)
-{
- struct sigaction act;
-
- /* Setup signal handler to map synchronous signals to appropriate
- exceptions. Make sure that the handler isn't interrupted by another
- signal that might cause a scheduling event!
-
- The handler is installed with SA_SIGINFO cleared, but there's no
- C++ prototype for the three-argument form, so fake it by using
- sa_sigaction and casting the arguments instead. */
-
- act.sa_sigaction = __gnat_error_handler;
- act.sa_flags = SA_NODEFER + SA_RESTART;
- sigfillset (&act.sa_mask);
- sigemptyset (&act.sa_mask);
-
- /* Do not install handlers if interrupt state is "System". */
- if (__gnat_get_interrupt_state (SIGABRT) != 's')
- sigaction (SIGABRT, &act, NULL);
- if (__gnat_get_interrupt_state (SIGFPE) != 's')
- sigaction (SIGFPE, &act, NULL);
- if (__gnat_get_interrupt_state (SIGILL) != 's')
- sigaction (SIGILL, &act, NULL);
- if (__gnat_get_interrupt_state (SIGSEGV) != 's')
- sigaction (SIGSEGV, &act, NULL);
- if (__gnat_get_interrupt_state (SIGBUS) != 's')
- sigaction (SIGBUS, &act, NULL);
- if (__gnat_get_interrupt_state (SIGADAABORT) != 's')
- sigaction (SIGADAABORT, &act, NULL);
-
- __gnat_handler_installed = 1;
-}
-
/*******************/
/* LynxOS Section */
/*******************/