binutils Newspaper
OCTOBER 6, 2026
gas — Committed

gas: fix MAX_ISTACK for loopgtz L32R widening

Increase MAX_ISTACK in gas for Xtensa to accommodate loopgtz relaxation.

A recent change in gas for Xtensa replaced loop widening with an L32R-based sequence. The loopgtz variant of this sequence requires 13 istack entries, exceeding the previous MAX_ISTACK limit of 12. This patch increases MAX_ISTACK to 16, documents the requirement, and improves overflow reporting. A new test case is included.

In Details

This patch increases MAX_ISTACK in gas/config/xtensa-istack.h from 12 to 16 to accommodate the instruction stack requirements of the loopgtz relaxation sequence, which now uses L32R instructions. It also modifies istack_push and istack_push_space in gas/config/tc-xtensa.c to report overflows using as_fatal. A new test case gas/testsuite/gas/xtensa/loopgtz-relax.s is added.

For Context
MAX_ISTACK
The maximum number of entries allowed on the instruction stack within the gas assembler for Xtensa targets.
loopgtz
A conditional branch instruction that continues looping as long as a counter is greater than zero.
L32R
A specific instruction encoding or type used in Xtensa architectures, likely related to 32-bit register loads.
relaxation
An optimization process performed by the assembler or linker to adjust instruction encodings or addresses for better code density or performance, often involving a temporary buffer (instruction stack).
instruction stack
A temporary buffer used by the assembler during instruction relaxation to store information about instructions and their potential modifications.
as_fatal
A function within the assembler (gas) used to report a fatal error and terminate the assembly process.
Filed Under: binutilsgasxtensaassembleroptimization