diff mbox

[RFC] Add aarch64 support for ada

Message ID 53514EEE.5030306@redhat.com
State New
Headers show

Commit Message

Richard Henderson April 18, 2014, 4:12 p.m. UTC
On 04/16/2014 12:55 AM, Eric Botcazou wrote:
>> Similarly with the HAVE_GNAT_ALTERNATE_STACK stuff.  There aren't any
>> linux hosts that don't support sigaltstack, so why is this
>> conditionalized?
> 
> Hum, I didn't know that Android also used the alternate stack...  OK, let's 
> use it unconditionally on Linux then, except for IA-64 which is a totally 
> different beast.  Can you change the patch accordingly?
> 

How about this?  I added a check vs MINSIGSTKSZ just in case, and updated the
commentary a bit.  While 16K is 2*SIGSTKSIZE for i686, it certainly isn't for
powerpc64.  But since things are working as-is I thought the revision is clearer.

Ok?


r~
* init.c [__linux__] (HAVE_GNAT_ALTERNATE_STACK): New define.
	(__gnat_alternate_stack): Enable for all linux except ia64.

Comments

Eric Botcazou April 22, 2014, 8:41 a.m. UTC | #1
> How about this?  I added a check vs MINSIGSTKSZ just in case, and updated
> the commentary a bit.  While 16K is 2*SIGSTKSIZE for i686, it certainly
> isn't for powerpc64.  But since things are working as-is I thought the
> revision is clearer.

Fine with me, thanks.
diff mbox

Patch

diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index c3824ab..48319d6 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -556,9 +556,14 @@  __gnat_error_handler (int sig, siginfo_t *si ATTRIBUTE_UNUSED, void *ucontext)
   Raise_From_Signal_Handler (exception, msg);
 }
 
-#if defined (i386) || defined (__x86_64__) || defined (__powerpc__)
-/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size.  */
-char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */
+#ifndef __ia64__
+#define HAVE_GNAT_ALTERNATE_STACK 1
+/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size.
+   It must be larger than MINSIGSTKSZ and hopefully near 2 * SIGSTKSZ.  */
+# if 16 * 1024 < MINSIGSTKSZ
+#  error "__gnat_alternate_stack too small"
+# endif
+char __gnat_alternate_stack[16 * 1024];
 #endif
 
 #ifdef __XENO__
@@ -612,7 +617,7 @@  __gnat_install_handler (void)
     sigaction (SIGBUS,  &act, NULL);
   if (__gnat_get_interrupt_state (SIGSEGV) != 's')
     {
-#if defined (i386) || defined (__x86_64__) || defined (__powerpc__)
+#ifdef HAVE_GNAT_ALTERNATE_STACK
       /* Setup an alternate stack region for the handler execution so that
 	 stack overflows can be handled properly, avoiding a SEGV generation
 	 from stack usage by the handler itself.  */