From 926890219d00e4f59cdc3afe4aba490049df04bd Mon Sep 17 00:00:00 2001 From: Doug Rupp Date: Mon, 21 May 2018 14:51:48 +0000 Subject: [PATCH] [Ada] Enhance stack unwinding on VxWorks for AArch64 2018-05-21 Doug Rupp gcc/ada/ * sigtramp-vxworks-target.inc: Set cfa_reg properly from sigcontext pregs. (CFI_COMMON_REGS): Restore LR jic probed from prologue. (REGNO_PC_OFFSET): Change to correct value for Aarch64. From-SVN: r260463 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/sigtramp-vxworks-target.inc | 20 +++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4954a17d0f8..1d41d1e2fca 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2018-04-04 Doug Rupp + + * sigtramp-vxworks-target.inc: Set cfa_reg properly from sigcontext + pregs. + (CFI_COMMON_REGS): Restore LR jic probed from prologue. + (REGNO_PC_OFFSET): Change to correct value for Aarch64. + 2018-04-04 Jose Ruiz * doc/gnat_ugn/gnat_utility_programs.rst, exp_attr.adb, diff --git a/gcc/ada/sigtramp-vxworks-target.inc b/gcc/ada/sigtramp-vxworks-target.inc index a49a48f8bb3..f8648f1b19e 100644 --- a/gcc/ada/sigtramp-vxworks-target.inc +++ b/gcc/ada/sigtramp-vxworks-target.inc @@ -6,7 +6,7 @@ * * * Asm Implementation Include File * * * - * Copyright (C) 2011-2017, Free Software Foundation, Inc. * + * Copyright (C) 2011-2018, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -100,17 +100,18 @@ #define FUNCTION "%function" #ifdef __aarch64__ -#define REGNO_PC_OFFSET 31 /* PC_REGNUM */ +#define REGNO_PC_OFFSET 80 /* aka V16, a scratch register */ #else -#define REGNO_PC_OFFSET 15 /* PC_REGNUM */ +#define REGNO_PC_OFFSET 15 /* PC_REGNUM */ #endif /* Mapping of CFI Column, Gcc Regno, Signal context offset for _LP64 Name CFI GCC SCTX - G0-G30 0-30 0-30 - PC 31 31 - V0-V31 64-95 32-63 + G0-G30 0-30 0-30 0-30 + SP 31 31 31 + PC 32 + V0-V31 64-95 32-63 N/A */ @@ -386,6 +387,7 @@ TCR(COMMON_CFI(G_REG_OFFSET(26))) \ TCR(COMMON_CFI(G_REG_OFFSET(27))) \ TCR(COMMON_CFI(G_REG_OFFSET(28))) \ TCR(COMMON_CFI(G_REG_OFFSET(29))) \ +TCR(COMMON_CFI(G_REG_OFFSET(30))) \ TCR(COMMON_CFI(PC_OFFSET)) \ TCR(".cfi_return_column " S(REGNO_PC_OFFSET)) #else @@ -417,10 +419,10 @@ TCR(".cfi_return_column " S(REGNO_PC_OFFSET)) CR("") \ TCR("# Push FP and LR on stack") \ TCR("stp x29, x30, [sp, #-16]!") \ -TCR("# Push register used to hold the CFA on stack") \ +TCR("# Push register used to hold the CFA on stack (pro forma)") \ TCR("str x" S(CFA_REG) ", [sp, #-8]!") \ -TCR("# Set the CFA: x2 value") \ -TCR("mov x" S(CFA_REG) ", x2") \ +TCR("# Set the CFA reg from the 5th arg") \ +TCR("mov x" S(CFA_REG) ", x4") \ TCR("# Call the handler") \ TCR("blr x3") \ TCR("# Release our frame and return (should never get here!).") \ -- 2.30.2