binutils Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gas

Restore recursion guards in i386-intel symbol simplification

This commit reintroduces recursion guards to the i386-intel symbol simplification logic in GAS to prevent infinite loops when processing complex symbol express…

The i386_intel_simplify_symbol function in GAS was previously modified, inadvertently removing recursion guards critical for handling complex symbol expressions. This omission led to unbounded recursion and crashes when the assembler encountered certain symbol definitions. The change restores these guards by adding symbol_resolving_p checks and marking symbols as resolving during the simplification process, thereby preventing infinite loops. This resolves a regression and improves the robustness of the i386-intel assembler.

In Details

The i386_intel_simplify_symbol function is part of the GNU Assembler (GAS) for the x86 architecture when operating in Intel syntax mode. It's responsible for simplifying symbol expressions, which can involve complex interdependencies like SYM1 = SYM2 + 10 or even recursive definitions. The symbol_resolving_p and symbol_mark_resolving mechanisms are internal to GAS's symbol table management, designed to detect and prevent infinite recursion during symbol resolution, a common hazard in complex assembly symbol definitions. This fix addresses a regression where these guards were removed,…

For Context

When you write assembly code, you often use symbolic names (like LOOP_START or BUFFER_SIZE) instead of raw memory addresses or numbers. The assembler, GAS in this case, needs to figure out the actual values for these symbols before it can turn your code into an executable program. Sometimes, symbol definitions can refer to other symbols, forming a chain or even a loop. For example, A = B + 10 and B = A - 5. If the assembler tries to resolve A, it goes to B, then back to A, creating an infinite loop and crashing. To prevent this, the assembler uses a mechanism to detect when it's trying to resolve a symbol it's already working on. This commit restores that safety mechanism for the i386-intel architecture within GAS, ensuring that complex symbol definitions don't cause the assembler to get stuck in an endless loop.

Filed Under: assembleri386intel-syntaxbugfixrecursion