[PATCH] [GAS] Fix tight loop on recursively-defined symbols

Alan Modra amodra@gmail.com
Mon May 18 04:15:55 GMT 2020


On Mon, May 18, 2020 at 08:34:45AM +0930, Alan Modra wrote:
> Not the latest though, and perhaps I'm compiling with different
> options.  I'll try to recreate the problem today, but if you can send
> me the .s file from the above libz_a-adler32 compile (or any other
> failing compile) that would speed things up.

Don't worry about the assembly.  I've recreated the problem and have
a fix that I'll install everywhere after testing.  (And of course
libz_a-adler32.o wasn't built for the target aarch64 but for my host.)

commit ae4e24a696ea34866c748cc9192ebeb38777ac22
Author: Alan Modra <amodra@gmail.com>
Date:   Mon May 18 13:30:59 2020 +0930

    Re: Fix tight loop on recursively-defined symbols
    
    sy_resolving ought to not be set for a struct local_symbol, but it is
    apparent from local_symbol_make that the field is not initialised.
    
            * symbols.c (resolve_symbol_value): Invoke LOCAL_SYMBOL_CHECK
            before looking at add_symbol->sy_flags.sy_resolving.

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 2a987616ec..30def43aae 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-18  Alan Modra  <amodra@gmail.com>
+
+	* symbols.c (resolve_symbol_value): Invoke LOCAL_SYMBOL_CHECK
+	before looking at add_symbol->sy_flags.
+
 2020-05-15  Alan Modra  <amodra@gmail.com>
 	    Alex Coplan  <alex.coplan@arm.com>
 
diff --git a/gas/symbols.c b/gas/symbols.c
index 711730daf1..b1376a57b4 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -1389,6 +1389,7 @@ resolve_symbol_value (symbolS *symp)
 
 	  /* Don't leave symbol loops.  */
 	  if (finalize_syms
+	      && !LOCAL_SYMBOL_CHECK (add_symbol)
 	      && add_symbol->sy_flags.sy_resolving)
 	    break;
 
-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list