binutils Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
risc-v/gas

Warn about non-power-of-2 stack-align attribute in RISC-V GAS

RISC-V assembler now warns about and flags non-power-of-2 stack-align attributes.

The RISC-V assembler (gas) now warns when the stack_align attribute is specified with a value that is not a power of two. Alignment values must be powers of two to be valid. This change ensures that the assembler flags such invalid configurations, helping developers identify potential issues early.

In Details

The s_riscv_attribute function in gas/config/tc-riscv.c has been updated to validate the Tag_RISCV_stack_align attribute. It now checks if the attribute value is non-zero and not a power of two using (attr[Tag_RISCV_stack_align].i & (attr[Tag_RISCV_stack_align].i - 1)). If the condition is met, as_warn is called to report the issue. This enforces that only valid power-of-two alignment values are used.

For Context
RISC-V
An open-source instruction set architecture (ISA) that is modular and extensible.
GAS
The GNU Assembler. It translates assembly language code into machine code.
stack-align attribute
A RISC-V specific attribute that specifies the alignment requirement for the stack pointer. This affects how function calls and stack frame management are handled.
power-of-2
A number that can be expressed as 2 raised to an integer exponent (e.g., 2, 4, 8, 16, 32, 64).
Filed Under: RISC-Vassemblerattributealignment