aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/init.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-11-13 14:11:30 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-11-13 14:11:30 +0100
commit6672e402095eb9df8517918c58929c145b9c1bc2 (patch)
treeb2c0b873dc782dd0985edac23610f821beb0f0c5 /gcc/ada/init.c
parentbc38dbb42271b6bdbc5e2e55200266aa5917f4bd (diff)
downloadgcc-6672e402095eb9df8517918c58929c145b9c1bc2.zip
gcc-6672e402095eb9df8517918c58929c145b9c1bc2.tar.gz
gcc-6672e402095eb9df8517918c58929c145b9c1bc2.tar.bz2
[multiple changes]
2015-11-13 Bob Duff <duff@adacore.com> * sem_ch6.adb (Check_Private_Overriding): Change name of Parent_Is_Private to be Overrides_Private_Part_Op, and use Unit_Declaration_Node. 2015-11-13 Bob Duff <duff@adacore.com> * sinfo.ads: Minor comment fix. * sem_ch6.adb: Minor reformatting. 2015-11-13 Jerome Lambourg <lambourg@adacore.com> * tracebak.c: Do not use the GCC Unwinder to retrieve traceback for x86_64-vx7. 2015-11-13 Eric Botcazou <ebotcazou@adacore.com> * init.c [Darwin/arm64]: Fix typo. * sigtramp-armios.c: Remove. * sigtramp-ios.c: New file. 2015-11-13 Doug Rupp <rupp@adacore.com> * s-stchop-vxworks.adb (Set_Stack_Limit_For_Current_Task): Set stack limit to 12000 decimal vice 12000 hexadecimal. From-SVN: r230315
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r--gcc/ada/init.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index dcd5c3d..4e95614 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -2381,13 +2381,14 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED,
uc->uc_mcontext->__ss.__rdx = t;
}
#elif defined(__arm64__)
+ /* Even though the CFI is marked as a signal frame, we need this. */
ucontext_t *uc = (ucontext_t *)ucontext;
uc->uc_mcontext->__ss.__pc++;
#endif
}
static void
-__gnat_map_signal (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED)
+__gnat_map_signal (int sig, siginfo_t *si, void *mcontext ATTRIBUTE_UNUSED)
{
struct Exception_Data *exception;
const char *msg;
@@ -2398,6 +2399,17 @@ __gnat_map_signal (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED)
case SIGBUS:
if (__gnat_is_stack_guard ((unsigned long)si->si_addr))
{
+#ifdef __arm64__
+ /* ??? This is a kludge to make stack checking work. The problem is
+ that the trampoline doesn't restore LR and, consequently, doesn't
+ make it possible to unwind past an interrupted frame which hasn"t
+ saved LR on the stack yet. Therefore, for probes in the prologue
+ (32-bit probes as opposed to standard 64-bit probes), we make the
+ unwinder skip the not-yet-established frame altogether. */
+ mcontext_t mc = (mcontext_t)mcontext;
+ if (!(*(unsigned int *)(mc->__ss.__pc-1) & ((unsigned int)1 << 30)))
+ mc->__ss.__pc = mc->__ss.__lr;
+#endif
exception = &storage_error;
msg = "stack overflow";
}
@@ -2409,7 +2421,7 @@ __gnat_map_signal (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED)
/* Reset the use of alt stack, so that the alt stack will be used
for the next signal delivery.
- The stack can't be used in case of stack checking. */
+ The stack can't be used in case of stack checking. */
syscall (SYS_sigreturn, NULL, UC_RESET_ALT_STACK);
break;
@@ -2432,17 +2444,7 @@ __gnat_error_handler (int sig, siginfo_t *si, void *ucontext)
__gnat_adjust_context_for_raise (sig, ucontext);
#ifdef __arm64__
- /* ??? Temporary kludge to make stack checking work. The problem is
- that the trampoline doesn't restore LR and, consequently, doesn't
- make it possible to unwind past an interrupted frame which hasn"t
- saved LR on the stack yet. */
- if (__gnat_is_stack_guard ((unsigned long)si->si_addr))
- {
- ucontext_t *uc = (ucontext_t *)ucontext;
- uc->uc_mcontext->__ss.__pc = uc->uc_mcontext->__ss.__lr;
- }
-
- /* Use a trampoline so that the unwinder won't see the signal frame. */
+ /* Use a trampoline so that the unwinder won't see the signal frame. */
__gnat_sigtramp (sig, (void *)si, ucontext,
(__sigtramphandler_t *)&__gnat_map_signal);
#else