aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/init.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-10-23 14:24:22 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2015-10-23 14:24:22 +0200
commit774454ac020f8c6a583393405ff8409d0b2f40fd (patch)
treeeba1ce95890c8b8d569f9435de42036be9b79836 /gcc/ada/init.c
parenteeedaac578d0a649955553e92ac9c2cd29cd40f0 (diff)
downloadgcc-774454ac020f8c6a583393405ff8409d0b2f40fd.zip
gcc-774454ac020f8c6a583393405ff8409d0b2f40fd.tar.gz
gcc-774454ac020f8c6a583393405ff8409d0b2f40fd.tar.bz2
[multiple changes]
2015-10-23 Hristian Kirtchev <kirtchev@adacore.com> * sem_util.adb (Denotes_Iterator): New routine. (Is_Iterator): Code cleanup. Factor out the detection of a predefined iterator. As a result this fixes a missing case where a tagged type implements interface Reversible_Iterator. 2015-10-23 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb (Eval_Attribute): Constant-fold 'Enabled if not within a generic unit, even if expander is not active, so that instances of container packages remain preelaborable in -gnatc mode. 2015-10-23 Tristan Gingold <gingold@adacore.com> * init.c (__gnat_sigtramp): New assembly function for arm64-darwin. (__gnat_error_handler): Use trampoline for arm64. 2015-10-23 Ed Schonberg <schonberg@adacore.com> * exp_ch3.adb (Expand_N_Object_Declaration): if the type of the object is a class-wide limited interface type, the expression is not restricted to the forms specified for limited types. 2015-10-23 Vincent Celier <celier@adacore.com> * gnatname.adb: Code clean up. * s-taasde.ads: Fix comment. From-SVN: r229240
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r--gcc/ada/init.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 443b338..c649d67 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -2256,6 +2256,47 @@ char __gnat_alternate_stack[32 * 1024]; /* 1 * MINSIGSTKSZ */
#include <mach/vm_statistics.h>
#endif
+#ifdef __arm64__
+#include <sys/ucontext.h>
+
+/* Trampoline inserted before raising the exception. It modifies the
+ stack so that PROC (D, M) looks to be called from the fault point. Note
+ that LR may be incorrectly set. */
+void __gnat_sigtramp (struct Exception_Data *d, const char *m,
+ mcontext_t ctxt,
+ void (*proc)(struct Exception_Data *, const char *));
+
+asm("\n"
+" .section __TEXT,__text,regular,pure_instructions\n"
+" .align 2\n"
+"___gnat_sigtramp:\n"
+" .cfi_startproc\n"
+ /* Restore callee saved registers. */
+" ldp x19, x20, [x2, #168]\n"
+" ldp x21, x22, [x2, #184]\n"
+" ldp x23, x24, [x2, #200]\n"
+" ldp x25, x26, [x2, #216]\n"
+" ldp x27, x28, [x2, #232]\n"
+" ldp q8, q9, [x2, #416]\n"
+" ldp q10, q11, [x2, #448]\n"
+" ldp q12, q13, [x2, #480]\n"
+" ldp q14, q15, [x2, #512]\n"
+ /* Read FP from mcontext. */
+" ldp fp, lr, [x2, #248]\n"
+ /* Read SP and PC from mcontext. */
+" ldp x6, x7, [x2, #264]\n"
+" add lr, x7, #1\n"
+" mov sp, x6\n"
+ /* Create a standard frame. */
+" stp fp, lr, [sp, #-16]!\n"
+" .cfi_def_cfa w29, 16\n"
+" .cfi_offset w30, -8\n"
+" .cfi_offset w29, -16\n"
+" br x3\n"
+" .cfi_endproc\n"
+);
+#endif
+
/* Return true if ADDR is within a stack guard area. */
static int
__gnat_is_stack_guard (mach_vm_address_t addr)
@@ -2363,6 +2404,15 @@ __gnat_error_handler (int sig, siginfo_t *si, void *ucontext)
for the next signal delivery.
The stack can't be used in case of stack checking. */
syscall (SYS_sigreturn, NULL, UC_RESET_ALT_STACK);
+
+#ifdef __arm64__
+ /* On arm64, use a trampoline so that the unwinder won't see the
+ signal frame. */
+ __gnat_sigtramp (exception, msg,
+ ((ucontext_t *)ucontext)->uc_mcontext,
+ Raise_From_Signal_Handler);
+ return;
+#endif
break;
case SIGFPE: