aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/init.c
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-11-08 17:32:18 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-11-08 17:32:18 +0000
commit8d9a1ba7bbd5bf5b7f5cfe1c88dd38d70ac54bbc (patch)
tree0d28abbe3786d9d0c64899f7a027fcd7065d8a71 /gcc/ada/init.c
parent76b37a56d234f98a8f30c9e22f24cb02edb75e23 (diff)
downloadgcc-8d9a1ba7bbd5bf5b7f5cfe1c88dd38d70ac54bbc.zip
gcc-8d9a1ba7bbd5bf5b7f5cfe1c88dd38d70ac54bbc.tar.gz
gcc-8d9a1ba7bbd5bf5b7f5cfe1c88dd38d70ac54bbc.tar.bz2
[multiple changes]
2017-11-08 Piotr Trojanek <trojanek@adacore.com> * lib-xref.ads, lib-xref-spark_specific.adb (Traverse_Compilation_Unit): Move declaration to package body. 2017-11-08 Hristian Kirtchev <kirtchev@adacore.com> * 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 <lambourg@adacore.com> * 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 <barboni@adacore.com> * exp_util.adb (Find_DIC_Type): Move... * sem_util.ads, sem_util.adb (Find_DIC_Type): ... here. 2017-11-08 Justin Squirek <squirek@adacore.com> * sem_res.adb (Resolve_Allocator): Add info messages corresponding to the owner and corresponding coextension. 2017-11-08 Ed Schonberg <schonberg@adacore.com> * 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
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r--gcc/ada/init.c100
1 files changed, 99 insertions, 1 deletions
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 <signal.h>
+#include <unistd.h>
+#include <string.h>
+#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