From 8d9a1ba7bbd5bf5b7f5cfe1c88dd38d70ac54bbc Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Wed, 8 Nov 2017 17:32:18 +0000 Subject: [multiple changes] 2017-11-08 Piotr Trojanek * lib-xref.ads, lib-xref-spark_specific.adb (Traverse_Compilation_Unit): Move declaration to package body. 2017-11-08 Hristian Kirtchev * exp_spark.adb (Expand_SPARK_N_Object_Renaming_Declaration): Obtain the type of the renaming from its defining entity, rather then the subtype mark as there may not be a subtype mark. 2017-11-08 Jerome Lambourg * adaint.c, s-oscons-tmplt.c, init.c, libgnat/system-qnx-aarch64.ads, libgnarl/a-intnam__qnx.ads, libgnarl/s-intman__qnx.adb, libgnarl/s-osinte__qnx.ads, libgnarl/s-qnx.ads, libgnarl/s-taprop__qnx.adb, s-oscons-tmplt.c, sigtramp-qnx.c, terminals.c: Initial port of GNAT for aarch64-qnx 2017-11-08 Elisa Barboni * exp_util.adb (Find_DIC_Type): Move... * sem_util.ads, sem_util.adb (Find_DIC_Type): ... here. 2017-11-08 Justin Squirek * sem_res.adb (Resolve_Allocator): Add info messages corresponding to the owner and corresponding coextension. 2017-11-08 Ed Schonberg * sem_aggr.adb (Resolve_Delta_Aggregate): Divide into the following separate procedures. (Resolve_Delta_Array_Aggregate): Previous code form Resolve_Delta_Aggregate. (Resolve_Delta_Record_Aggregate): Extend previous code to cover latest ARG decisions on the legality rules for delta aggregates for records: in the case of a variant record, components from different variants cannot be specified in the delta aggregate, and this must be checked statically. From-SVN: r254547 --- gcc/ada/init.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) (limited to 'gcc/ada/init.c') diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 4071bb4..e1cf4fa 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -2516,6 +2516,104 @@ __gnat_install_handler (void) __gnat_handler_installed = 1; } +#elif defined(__QNX__) + +/***************/ +/* QNX Section */ +/***************/ + +#include +#include +#include +#include "sigtramp.h" + +void +__gnat_map_signal (int sig, + siginfo_t *si ATTRIBUTE_UNUSED, + void *mcontext ATTRIBUTE_UNUSED) +{ + struct Exception_Data *exception; + const char *msg; + + switch(sig) + { + case SIGFPE: + exception = &constraint_error; + msg = "SIGFPE"; + break; + case SIGILL: + exception = &constraint_error; + msg = "SIGILL"; + break; + case SIGSEGV: + exception = &storage_error; + msg = "stack overflow or erroneous memory access"; + break; + case SIGBUS: + exception = &constraint_error; + msg = "SIGBUS"; + break; + default: + exception = &program_error; + msg = "unhandled signal"; + } + + Raise_From_Signal_Handler (exception, msg); +} + +static void +__gnat_error_handler (int sig, siginfo_t *si, void *ucontext) +{ + __gnat_sigtramp (sig, (void *) si, (void *) ucontext, + (__sigtramphandler_t *)&__gnat_map_signal); +} + +void +__gnat_install_handler (void) +{ + struct sigaction act; + int err; + + act.sa_handler = __gnat_error_handler; + act.sa_flags = SA_NODEFER | SA_SIGINFO; + sigemptyset (&act.sa_mask); + + /* Do not install handlers if interrupt state is "System" */ + if (__gnat_get_interrupt_state (SIGFPE) != 's') { + err = sigaction (SIGFPE, &act, NULL); + if (err == -1) { + err = errno; + perror ("error while attaching SIGFPE"); + perror (strerror (err)); + } + } + if (__gnat_get_interrupt_state (SIGILL) != 's') { + sigaction (SIGILL, &act, NULL); + if (err == -1) { + err = errno; + perror ("error while attaching SIGFPE"); + perror (strerror (err)); + } + } + if (__gnat_get_interrupt_state (SIGSEGV) != 's') { + sigaction (SIGSEGV, &act, NULL); + if (err == -1) { + err = errno; + perror ("error while attaching SIGFPE"); + perror (strerror (err)); + } + } + if (__gnat_get_interrupt_state (SIGBUS) != 's') { + sigaction (SIGBUS, &act, NULL); + if (err == -1) { + err = errno; + perror ("error while attaching SIGFPE"); + perror (strerror (err)); + } + } + __gnat_handler_installed = 1; +} + #elif defined (__DJGPP__) void @@ -2648,7 +2746,7 @@ __gnat_install_handler (void) #if defined (_WIN32) || defined (__INTERIX) \ || defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__) \ - || defined (__OpenBSD__) || defined (__DragonFly__) + || defined (__OpenBSD__) || defined (__DragonFly__) || defined(__QNX__) #define HAVE_GNAT_INIT_FLOAT -- cgit v1.1