diff options
author | Doug Rupp <rupp@adacore.com> | 2022-05-06 15:28:49 -0700 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-06-01 08:43:19 +0000 |
commit | 9ba4b38f6ac6d80130808943f20011ab8855695d (patch) | |
tree | d737f765fa8f9b653f74e7158f3e4917ab26b99b /gcc/ada/init.c | |
parent | 65818fc9550ffda7724504e38c8d2005f6c4f2ca (diff) | |
download | gcc-9ba4b38f6ac6d80130808943f20011ab8855695d.zip gcc-9ba4b38f6ac6d80130808943f20011ab8855695d.tar.gz gcc-9ba4b38f6ac6d80130808943f20011ab8855695d.tar.bz2 |
[Ada] arm-qnx-7.1: unwind goes wrong after regs restore
Bump the pc +3 total for Thumb mode, the same calculation that as is
done for arm-linux.
gcc/ada/
* init.c (__gnat_adjust_context_for_raise) [QNX][__thumb2__]: Bump
the pc an extra byte.
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r-- | gcc/ada/init.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 7322a54..cfae740 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -2579,7 +2579,17 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, uintptr_t *pc_addr; mcontext_t *mcontext = &((ucontext_t *) sc)->uc_mcontext; pc_addr = (uintptr_t *)&mcontext->cpu.gpr [ARM_REG_PC]; + + /* ARM Bump has to be an even number because of odd/even architecture. */ *pc_addr += 2; +#ifdef __thumb2__ + /* For thumb, the return address must have the low order bit set, otherwise + the unwinder will reset to "arm" mode upon return. As long as the + compilation unit containing the landing pad is compiled with the same + mode (arm vs thumb) as the signaling compilation unit, this works. */ + if (mcontext->cpu.spsr & ARM_CPSR_T) + *pc_addr += 1; +#endif } #endif /* ARMEL */ |