https://gcc.gnu.org/g:964b279b15bc165056f7a57f43c7c1a95c135cf2
commit r17-889-g964b279b15bc165056f7a57f43c7c1a95c135cf2 Author: Sebastian Poeplau <[email protected]> Date: Wed Mar 4 10:06:07 2026 +0100 ada: Align the alternate stack on Linux for address sanitizer Address sanitizer requires the memory region configured via sigaltstack to be 8-byte aligned (see ASAN_SHADOW_GRANULARITY and ASAN_SHADOW_SCALE). gcc/ada/ChangeLog: * init.c (__gnat_alternate_stack): add alignment attribute. Diff: --- gcc/ada/init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 7aced7fe8139..68f374809202 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -594,8 +594,10 @@ __gnat_error_handler (int sig, siginfo_t *si ATTRIBUTE_UNUSED, void *ucontext) #ifndef __ia64__ #define HAVE_GNAT_ALTERNATE_STACK 1 -/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. */ -char __gnat_alternate_stack[32 * 1024]; +/* Address sanitizer requires the alternate stack to be 8-byte aligned, + regardless of any extra alignment added by the operating system. The size + must be in keeping with System.OS_Interface.Alternate_Stack_Size. */ +char __gnat_alternate_stack[32 * 1024] __attribute__ ((aligned (8))); #endif #ifdef __XENO__
