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]

[RFC] Add aarch64 support for ada


From: Richard Henderson <rth@redhat.com>

The primary bit of rfc here is the hunk that applies to ada/types.h
with respect to Fat_Pointer.  Given that the Ada type, as defined in
s-stratt.ads, does not include alignment, I can't imagine why the C
type should have it.

This causes problems with the AArch64 calling convention, which honors
this alignment in the set of registers it chooses to pass the struct.
One can see this difference in create_concat_name vs
Exp_Dbug.Get_External_Name_With_Suffix.

The secondary bit of rfc is in the Makefile change.  In particular,

+  system.ads<system-linux-x86_64.ads

IMO, this should really be called system-linux-lp64.ads, and should
be usable for any 64-bit target that uses full ieee floating point,
which is all of them.

IMO basically all of the differences between x86 and the other linux
targets is a bug in the other linux targets.  I.e. missing functionality.
There are rare exceptions, such as ARM32 and its AAPCS unwinding.

Similarly with the HAVE_GNAT_ALTERNATE_STACK stuff.  There aren't any
linux hosts that don't support sigaltstack, so why is this
conditionalized?

Anyway, 

                === gnat Summary ===

# of expected passes            2308
# of expected failures          34
# of unsupported tests          22


I'll see about puting some rpms somewhere public so that no one else
has to do the whole canadian-cross compile dance.


r~


	* gcc-interface/Makefile.in: Support aarch64-linux.
	* init.c (__gnat_alternate_stack): Use for aarch64.
	(__gnat_install_handler): Do sigaltstack for aarch64 too.
	* types.h (Fat_Pointer): Remove alignment attribute.


diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index dc5e912..302d9a3 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -2123,6 +2123,44 @@ ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
   LIBRARY_VERSION := $(LIB_VERSION)
 endif
 
+# AArch64 Linux
+ifeq ($(strip $(filter-out aarch64% linux%,$(arch) $(osys))),)
+  LIBGNAT_TARGET_PAIRS = \
+  a-exetim.adb<a-exetim-posix.adb \
+  a-exetim.ads<a-exetim-default.ads \
+  a-intnam.ads<a-intnam-linux.ads \
+  a-synbar.adb<a-synbar-posix.adb \
+  a-synbar.ads<a-synbar-posix.ads \
+  s-inmaop.adb<s-inmaop-posix.adb \
+  s-intman.adb<s-intman-posix.adb \
+  s-linux.ads<s-linux.ads \
+  s-mudido.adb<s-mudido-affinity.adb \
+  s-osinte.ads<s-osinte-linux.ads \
+  s-osinte.adb<s-osinte-posix.adb \
+  s-osprim.adb<s-osprim-posix.adb \
+  s-taprop.adb<s-taprop-linux.adb \
+  s-tasinf.ads<s-tasinf-linux.ads \
+  s-tasinf.adb<s-tasinf-linux.adb \
+  s-tpopsp.adb<s-tpopsp-tls.adb \
+  s-taspri.ads<s-taspri-posix.ads \
+  g-sercom.adb<g-sercom-linux.adb \
+  $(ATOMICS_TARGET_PAIRS) \
+  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
+  system.ads<system-linux-x86_64.ads
+  ## ^^ Note the above is a pretty-close placeholder.
+
+  TOOLS_TARGET_PAIRS =  \
+    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+    indepsw.adb<indepsw-gnu.adb
+
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
+  EH_MECHANISM=-gcc
+  THREADSLIB=-lpthread -lrt
+  GNATLIB_SHARED=gnatlib-shared-dual
+  GMEM_LIB = gmemlib
+  LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
 # x86-64 Linux
 ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
   LIBGNAT_TARGET_PAIRS = \
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index f5c3a81..0ac2398 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -562,7 +562,9 @@ __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__)
+#if defined (i386) || defined (__x86_64__) || defined (__powerpc__) \
+    || defined (__aarch64__)
+#define HAVE_GNAT_ALTERNATE_STACK 1
 /* This must be in keeping with System.OS_Interface.Alternate_Stack_Size.  */
 char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */
 #endif
@@ -603,7 +605,7 @@ __gnat_install_handler (void)
      handled properly, avoiding a SEGV generation from stack usage by the
      handler itself.  */
 
-#if defined (i386) || defined (__x86_64__) || defined (__powerpc__)
+#ifdef HAVE_GNAT_ALTERNATE_STACK
   stack_t stack;
   stack.ss_sp = __gnat_alternate_stack;
   stack.ss_size = sizeof (__gnat_alternate_stack);
@@ -624,7 +626,7 @@ __gnat_install_handler (void)
     sigaction (SIGILL,  &act, NULL);
   if (__gnat_get_interrupt_state (SIGBUS) != 's')
     sigaction (SIGBUS,  &act, NULL);
-#if defined (i386) || defined (__x86_64__) || defined (__powerpc__)
+#ifdef HAVE_GNAT_ALTERNATE_STACK
   act.sa_flags |= SA_ONSTACK;
 #endif
   if (__gnat_get_interrupt_state (SIGSEGV) != 's')
diff --git a/gcc/ada/types.h b/gcc/ada/types.h
index a0f2891..6b3db93 100644
--- a/gcc/ada/types.h
+++ b/gcc/ada/types.h
@@ -79,8 +79,7 @@ typedef Char *Str_Ptr;
 /* Types for the fat pointer used for strings and the template it
    points to.  */
 typedef struct {int Low_Bound, High_Bound; } String_Template;
-typedef struct {const char *Array; String_Template *Bounds; }
-	__attribute ((aligned (sizeof (char *) * 2))) Fat_Pointer;
+typedef struct {const char *Array; String_Template *Bounds; } Fat_Pointer;
 
 /* Types for Node/Entity Kinds:  */
 
-- 
1.9.0


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