From 38b19664d378007263aca467bac9efac2ab0ad25 Mon Sep 17 00:00:00 2001 From: Yikai Zhao Date: Fri, 24 May 2024 19:33:00 +0800 Subject: [PATCH] generic_fp stacktrace: aarch64 frame pointer may be 8 byte aligned --- src/stacktrace_generic_fp-inl.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stacktrace_generic_fp-inl.h b/src/stacktrace_generic_fp-inl.h index 12f93bb..c0d458c 100644 --- a/src/stacktrace_generic_fp-inl.h +++ b/src/stacktrace_generic_fp-inl.h @@ -177,8 +177,12 @@ int capture(void **result, int max_depth, int skip_count, // older gcc's (circa gcc 6 or so) did something that looks right, // but not recent ones). constexpr uintptr_t kAlignment = 4; +#elif defined(__aarch64__) + // aarch64 ABI does not specify the frame pointer location, so we can only + // know it's 8 byte aligned (as the register size) + constexpr uintptr_t kAlignment = 8; #else - // This is simplistic yet. Here we're targeting x86, aarch64 and + // This is simplistic yet. Here we're targeting x86 and // riscv. They all have 16 bytes stack alignment (even 32 bit // riscv). This can be made more elaborate as we consider more // architectures.