[PATCH v2] x86/Intel: avoid infinite recursion in i386_intel_simplify_symbol() (again)

Alan Modra amodra@gmail.com
Sat May 16 04:16:34 GMT 2026


On Fri, May 15, 2026 at 03:03:32PM +0200, Jan Beulich wrote:
> @@ -405,6 +409,11 @@ i386_intel_simplify_symbol (symbolS *sym
>  	  if (e->X_op == O_symbol && !e->X_add_number)
>  	    {
>  	      sym = e->X_add_symbol;
> +	      if (symbol_resolving_p (sym))
> +		return sym;
> +	      seg = S_GET_SEGMENT (sym);
> +	      if (seg != expr_section && seg != reg_section)
> +		return sym;
>  	      continue;
>  	    }
>  	  sym = make_expr_symbol (e);

I suspect that trying to cut the loop like this is wrong.

I don't have a testcase specific to this change but in trying to
create one I found the following:

 .intel_syntax noprefix
a=b
b=esi
x=a
a=1
b=2
 mov eax,[x]

Contrast with:
 .intel_syntax noprefix
x=esi
 mov eax,[x]

-- 
Alan Modra


More information about the Binutils mailing list