GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Ada: Align alternate stack on Linux for address sanitizer.

The Ada runtime now aligns the alternate stack on Linux to meet the requirements of the address sanitizer.

The address sanitizer (ASan) requires the alternate stack to be 8-byte aligned. This commit adds an alignment attribute to the alternate stack in the Ada runtime when compiling for Linux. This ensures compatibility with ASan, which detects memory errors, when using alternate stacks.

In Details

The Ada runtime uses an alternate stack, configured via sigaltstack. AddressSanitizer (ASan) requires the memory region configured via sigaltstack to be 8-byte aligned due to ASAN_SHADOW_GRANULARITY and ASAN_SHADOW_SCALE. This commit adds an alignment attribute to __gnat_alternate_stack in init.c to ensure proper alignment on Linux.

For Context

Address Sanitizer (ASan) is a memory error detector. It requires specific memory alignment for certain data structures. This commit aligns the alternate stack used by the Ada runtime on Linux systems to meet ASan's requirements. This improves the reliability of Ada programs by ensuring ASan can properly detect memory errors when alternate stacks are used.

Filed Under: adaasanmemoryalignment