[3/8] gas: centralize declaration of listing_tail

Message ID eaf6e96d-197e-49c7-8f5f-5d7c883a340e@suse.com
State New
Headers
Series gas: CFI directive and listing adjustments |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply

Commit Message

Jan Beulich Feb. 26, 2025, 3:16 p.m. UTC
  Besides it being somewhat off to have three decls scattered across the
code base, it is generally bad practice for the definition of a symbol
to not also observe its declaration (making sure the two won't go out of
sync).
  

Patch

--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -3260,7 +3260,6 @@  s_thumb_set (int equiv)
 	 for this symbol.  */
       if (listing & LISTING_SYMBOLS)
 	{
-	  extern struct list_info_struct * listing_tail;
 	  fragS * dummy_frag = (fragS * ) xmalloc (sizeof (fragS));
 
 	  memset (dummy_frag, 0, sizeof (fragS));
--- a/gas/frags.c
+++ b/gas/frags.c
@@ -192,10 +192,7 @@  frag_new (size_t old_frags_var_max_size
   frchP->frch_last = frag_now;
 
 #ifndef NO_LISTING
-  {
-    extern struct list_info_struct *listing_tail;
-    frag_now->line = listing_tail;
-  }
+  frag_now->line = listing_tail;
 #endif
 
   gas_assert (frchain_now->frch_last == frag_now);
--- a/gas/listing.h
+++ b/gas/listing.h
@@ -62,6 +62,8 @@  extern int listing_lhs_width_second;
 extern int listing_lhs_cont_lines;
 extern int listing_rhs_width;
 
+extern struct list_info_struct *listing_tail;
+
 #endif /* __listing_h__ */
 
 /* end of listing.h */
--- a/gas/read.c
+++ b/gas/read.c
@@ -3274,7 +3274,6 @@  assign_symbol (char *name, int mode)
 	 for this symbol.  */
       if (listing & LISTING_SYMBOLS)
 	{
-	  extern struct list_info_struct *listing_tail;
 	  fragS *dummy_frag = notes_calloc (1, sizeof (*dummy_frag));
 	  dummy_frag->line = listing_tail;
 	  dummy_frag->fr_symbol = symbolP;