x86/Intel: avoid infinite recursion in i386_intel_simplify_symbol() (again)
Fixes a potential infinite recursion in the x86 assembler's symbol simplification logic, and adds a test case to prevent regressions.
This patch addresses a re-emergence of an infinite recursion issue within the i386_intel_simplify_symbol() function in the x86 assembler. The problem arises when dealing with equates and symbol chains. The patch enhances the use of the ‘resolving’ property to prevent the recursion. A new test case is added to ensure this issue doesn’t reappear in future updates, enhancing the assembler’s stability.
In Details
The i386_intel_simplify_symbol function in gas/config/tc-i386-intel.c simplifies symbols during assembly of x86 Intel syntax. The function can enter infinite recursion when processing chains of equates. The patch uses the symbol_resolving_p property to detect and prevent such loops. A new test case gas/testsuite/gas/i386/intel-equ-loop.l is added.
For Context
The GNU assembler (gas) translates assembly language into machine code. Equates (using the .equ directive) define symbolic constants. The assembler simplifies symbols, replacing them with their constant values where possible. This patch fixes a bug in the x86-specific symbol simplification logic that could cause the assembler to get stuck in an infinite loop when processing complex chains of equates, leading to a build failure. The fix prevents this recursion and improves assembler robustness.