This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] map synch. signals to exceptions on IA-64/Linux


For transforming signals into Ada exceptions we need to install the
appropriate signal handlers; for the IA-64/Linux target we reuse the
Linux-specific code.  Moreover, when adjusting the signal context for
unwinding through signal handlers, we need to increment the PC to
account for later adjustements.

Testcase attached, compile with -gnatp.

Tested on ia64-sgi-linux-gnu and ia64-hp-linux-gnu, applied to mainline.


2005-11-08  Eric Botcazou  <ebotcazou@adacore.com>

	* init.c: Use the Linux-specific section for the IA-64/Linux target.
	(__gnat_adjust_context_for_raise): Add conditional code so that the
	IA-64 is also supported.

-- 
Eric Botcazou
Index: init.c
===================================================================
RCS file: /gnat.dev/cvs/Dev/gnat/init.c,v
retrieving revision 1.105
retrieving revision 1.107
diff -u -p -r1.105 -r1.107
--- init.c	29 Aug 2005 13:24:14 -0000	1.105
+++ init.c	3 Oct 2005 15:32:10 -0000	1.107
@@ -39,9 +39,9 @@
     installed by this file are used to handle resulting signals that come
     from these probes failing (i.e. touching protected pages) */
 
-/* This file should be kept synchronized with 2sinit.ads, 2sinit.adb, and
-   5zinit.adb. All these files implement the required functionality for
-   different targets. */
+/* This file should be kept synchronized with 2sinit.ads, 2sinit.adb,
+   s-init-ae653-cert.adb and s-init-xi-sparc.adb. All these files implement
+   the required functionality for different targets. */
 
 /* The following include is here to meet the published VxWorks requirement
    that the __vxworks header appear before any other include. */
@@ -630,7 +630,8 @@ __gnat_install_handler (void)
 /* GNU/Linux Section */
 /*********************/
 
-#elif defined (linux) && (defined (i386) || defined (__x86_64__))
+#elif defined (linux) && (defined (i386) || defined (__x86_64__) \
+                          || defined (__ia64__))
 
 #include <signal.h>
 
@@ -660,6 +661,8 @@ __gnat_adjust_context_for_raise (int sig
   mcontext->gregs[REG_EIP]++;
 #elif defined (__x86_64__)
   mcontext->gregs[REG_RIP]++;
+#elif defined (__ia64__)
+  mcontext->sc_ip++;
 #endif
 }
 
with Ada.Text_IO;

procedure FPE is
   D : Integer;

   function Return_Zero return Integer is
   begin
      return 0;
   end Return_Zero;

begin
   D := Return_Zero;

   declare
   begin
      D := 1 / D;
   exception
      when Constraint_Error =>
         Ada.Text_IO.Put_Line ("FPE Handler");
   end;
end FPE;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]