[binutils-gdb] weakref gas internal error

Alan Modra amodra@sourceware.org
Sun Jun 1 03:56:47 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=829b08e405a4da9f28e2ce9c386a607b6960037b

commit 829b08e405a4da9f28e2ce9c386a607b6960037b
Author: Alan Modra <amodra@gmail.com>
Date:   Sat May 31 13:49:24 2025 +0930

    weakref gas internal error
    
    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.
    
            * read.c (assign_symbol): Clear weakrefr.

Diff:
---
 gas/read.c | 1 +
 1 file changed, 1 insertion(+)

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)


More information about the Binutils-cvs mailing list