Alpha: Enable stack protector support
Alpha architecture now supports -fstack-protector by correctly configuring stack growth direction.
This commit enables the stack protector feature for the Alpha architecture by correctly defining FRAME_GROWS_DOWNWARD. Previously, this was left commented out, causing -fstack-protector to be rejected. The fix ensures the stack grows downwards, which is necessary for the canary to properly guard buffers. This change is compatible with existing glibc support and does not alter default code generation.
In Details
The Alpha backend previously had FRAME_GROWS_DOWNWARD undefined, leading to rejection of -fstack-protector with a 'not supported' error. This commit defines FRAME_GROWS_DOWNWARD when flag_stack_protect is set, ensuring the stack frame grows downwards. This is crucial because the stack protector canary is allocated before local arrays; a downward-growing stack places the canary above the buffers. The code also adjusts alpha_initial_elimination_offset to resolve the frame pointer to the top of locals in this configuration, mirroring behavior on targets like RS/6000 and Xtensa.
- stack protector
- A security feature (e.g., -fstack-protector) that adds a 'canary' value to the stack to detect buffer overflows. If the canary is overwritten, it indicates an overflow, and the program typically terminates to prevent exploitation.
- FRAME_GROWS_DOWNWARD
- A target-specific macro indicating whether the stack frame grows towards lower memory addresses (downward) or higher memory addresses (upward).
- stack frame
- A region of memory allocated on the call stack for a function call, containing local variables, parameters, and return address.