#define DWARF_REGNUM_AARCH64_RA_STATE 34
-#define MD_POST_EXTRACT_ROOT_ADDR(addr) __builtin_aarch64_xpaclri (addr)
-#define MD_POST_EXTRACT_FRAME_ADDR(context, fs, addr) \
- aarch64_post_extract_frame_addr (context, fs, addr)
-#define MD_POST_FROB_EH_HANDLER_ADDR(current, target, addr) \
- aarch64_post_frob_eh_handler_addr (current, target, addr)
+#define MD_DEMANGLE_RETURN_ADDR(context, fs, addr) \
+ aarch64_demangle_return_addr (context, fs, addr)
#define MD_FROB_UPDATE_CONTEXT(context, fs) \
aarch64_frob_update_context (context, fs)
return 0;
}
-/* Do AArch64 private extraction on ADDR based on context info CONTEXT and
- unwind frame info FS. If ADDR is signed, we do address authentication on it
- using CFA of current frame. */
+/* Do AArch64 private extraction on ADDR_WORD based on context info CONTEXT and
+ unwind frame info FS. If ADDR_WORD is signed, we do address authentication
+ on it using CFA of current frame. */
static inline void *
-aarch64_post_extract_frame_addr (struct _Unwind_Context *context,
- _Unwind_FrameState *fs, void *addr)
+aarch64_demangle_return_addr (struct _Unwind_Context *context,
+ _Unwind_FrameState *fs, _Unwind_Word addr_word)
{
+ void *addr = (void *)addr_word;
if (context->flags & RA_SIGNED_BIT)
{
_Unwind_Word salt = (_Unwind_Word) context->cfa;
return addr;
}
-/* Do AArch64 private frob on exception handler's address HANDLER_ADDR before
- installing it into current context CURRENT. TARGET is currently not used.
- We need to sign exception handler's address if CURRENT itself is signed. */
-
-static inline void *
-aarch64_post_frob_eh_handler_addr (struct _Unwind_Context *current,
- struct _Unwind_Context *target
- ATTRIBUTE_UNUSED,
- void *handler_addr)
-{
- if (current->flags & RA_SIGNED_BIT)
- {
- if (aarch64_cie_signed_with_b_key (current))
- return __builtin_aarch64_pacib1716 (handler_addr,
- (_Unwind_Word) current->cfa);
- return __builtin_aarch64_pacia1716 (handler_addr,
- (_Unwind_Word) current->cfa);
- }
- else
- return handler_addr;
-}
-
/* Do AArch64 private initialization on CONTEXT based on frame info FS. Mark
CONTEXT as return address signed if bit 0 of DWARF_REGNUM_AARCH64_RA_STATE is
set. */
{
/* Compute the return address now, since the return address column
can change from frame to frame. */
- context->ra = __builtin_extract_return_addr
- (_Unwind_GetPtr (context, fs->retaddr_column));
-#ifdef MD_POST_EXTRACT_FRAME_ADDR
- context->ra = MD_POST_EXTRACT_FRAME_ADDR (context, fs, context->ra);
+ void *ret_addr;
+#ifdef MD_DEMANGLE_RETURN_ADDR
+ _Unwind_Word ra = _Unwind_GetGR (context, fs->retaddr_column);
+ ret_addr = MD_DEMANGLE_RETURN_ADDR (context, fs, ra);
+#else
+ ret_addr = _Unwind_GetPtr (context, fs->retaddr_column);
#endif
+ context->ra = __builtin_extract_return_addr (ret_addr);
}
}
void *outer_cfa, void *outer_ra)
{
void *ra = __builtin_extract_return_addr (__builtin_return_address (0));
-#ifdef MD_POST_EXTRACT_ROOT_ADDR
- ra = MD_POST_EXTRACT_ROOT_ADDR (ra);
-#endif
_Unwind_FrameState fs;
_Unwind_SpTmp sp_slot;
_Unwind_Reason_Code code;
initialization context, then we can't see it in the given
call frame data. So have the initialization context tell us. */
context->ra = __builtin_extract_return_addr (outer_ra);
-#ifdef MD_POST_EXTRACT_ROOT_ADDR
- context->ra = MD_POST_EXTRACT_ROOT_ADDR (context->ra);
-#endif
}
static void _Unwind_DebugHook (void *, void *)
#endif
}
-/* Frob exception handler's address kept in TARGET before installing into
- CURRENT context. */
-
-static inline void *
-uw_frob_return_addr (struct _Unwind_Context *current
- __attribute__ ((__unused__)),
- struct _Unwind_Context *target)
-{
- void *ret_addr = __builtin_frob_return_addr (target->ra);
-#ifdef MD_POST_FROB_EH_HANDLER_ADDR
- ret_addr = MD_POST_FROB_EH_HANDLER_ADDR (current, target, ret_addr);
-#endif
- return ret_addr;
-}
-
/* Install TARGET into CURRENT so that we can return to it. This is a
macro because __builtin_eh_return must be invoked in the context of
our caller. FRAMES is a number of frames to be unwind.
do \
{ \
long offset = uw_install_context_1 ((CURRENT), (TARGET)); \
- void *handler = uw_frob_return_addr ((CURRENT), (TARGET)); \
+ void *handler = __builtin_frob_return_addr ((TARGET)->ra); \
_Unwind_DebugHook ((TARGET)->cfa, handler); \
_Unwind_Frames_Extra (FRAMES); \
__builtin_eh_return (offset, handler); \