https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84521
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Target Milestone|--- |8.0
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/config/aarch64/aarch64.c.jj 2018-02-22 09:26:12.028616476 +0100
+++ gcc/config/aarch64/aarch64.c 2018-02-22 20:23:29.449621557 +0100
@@ -7432,6 +7432,20 @@ aarch64_secondary_reload (bool in_p ATTR
return NO_REGS;
}
+/* Value should be nonzero if functions must have frame pointers.
+ Zero means the frame pointer need not be set up (and parms may
+ be accessed via the stack pointer) in functions that seem suitable. */
+
+static bool
+aarch64_frame_pointer_required (void)
+{
+ /* __builtin_setjmp requries frame pointers. */
+ if (cfun->calls_setjmp)
+ return true;
+
+ return false;
+}
+
static bool
aarch64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
{
@@ -17463,6 +17477,9 @@ aarch64_run_selftests (void)
#undef TARGET_CALLEE_COPIES
#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED aarch64_frame_pointer_required
+
#undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE aarch64_can_eliminate
(completely untested) would require frame pointers for all setjmp calls, not
just __builtin_setjmp.
I agree pretty much all uses of __builtin_setjmp are a bug, but somebody needs
to explain it to the ruby authors. It is even weirder because they are using
the builtin with jmp_buf variable, jmp_buf is for the libc setjmp, for
__builtin_setjmp I think it is just void *buf[5]; or something similar.
BTW, does __builtin_return_address really work on aarch64 without frame
pointers? Various other targets require frame pointers when
cfun->machine->access_prev_frame (i.e. when SETUP_FRAME_ADDRESSES () has been
used).