weakref gas internal error

Jan Beulich jbeulich@suse.com
Mon Jun 2 06:46:54 GMT 2025


On 01.06.2025 05:56, Alan Modra wrote:
> This horrible testcase (cleaned up from oss-fuzz)
>  r=x*2
>  x=r-r
>  .weakref r,x
>  r=r-5
> triggers resolve_symbol_value "gas_assert (final_val == 0)" in weakref
> handling.
> 
> I'm not at all certain what we should do with this, but for now I'm
> treating any assignment to r after the .weakref as a redefinition
> that loses the weakrefr flag.

Right, probably the best we can do. I seem to vaguely recall that in at least
one other place we do exactly this.

Jan

> 	* read.c (assign_symbol): Clear weakrefr.
> 
> diff --git a/gas/read.c b/gas/read.c
> index 145a39c8652..c9cbd224a7d 100644
> --- a/gas/read.c
> +++ b/gas/read.c
> @@ -3306,6 +3306,7 @@ assign_symbol (char *name, int mode)
>  	 retain the value of the symbol at the point of use.  */
>        else if (S_IS_VOLATILE (symbolP))
>  	symbolP = symbol_clone (symbolP, 1);
> +      S_CLEAR_WEAKREFR (symbolP);
>      }
>  
>    if (mode == 0)
> 	* read.c (assign_symbol): Clear weakrefr.
> 



More information about the Binutils mailing list