public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* gas/dwarf2dbg.c init more statics
@ 2023-03-14  2:04 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-03-14  2:04 UTC (permalink / raw)
  To: binutils

	* dwarf2dbg.c (dw2_line, dw2_filename): Move to file scope and..
	(dwarf2_gen_line_info): ..renamed from here.
	(label_num, last_used, last_used_dir_len): Move to file scope.
	(dwarf2_init): Init moved statics, except last_used_dir_len.

diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index f04f2975b5b..331264b1f6f 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -536,6 +536,10 @@ dwarf2_gen_line_info_1 (symbolS *label, struct dwarf2_line_info *loc)
 
 /* Record an entry for LOC occurring at OFS within the current fragment.  */
 
+static unsigned int dw2_line;
+static const char *dw2_filename;
+static int label_num;
+
 void
 dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc)
 {
@@ -558,27 +562,23 @@ dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc)
      uses them to determine the end of the prologue.  */
   if (debug_type == DEBUG_DWARF2)
     {
-      static unsigned int line = -1;
-      static const char *filename = NULL;
-
-      if (line == loc->line)
+      if (dw2_line == loc->line)
 	{
-	  if (filename == loc->u.filename)
+	  if (dw2_filename == loc->u.filename)
 	    return;
-	  if (filename_cmp (filename, loc->u.filename) == 0)
+	  if (filename_cmp (dw2_filename, loc->u.filename) == 0)
 	    {
-	      filename = loc->u.filename;
+	      dw2_filename = loc->u.filename;
 	      return;
 	    }
 	}
 
-      line = loc->line;
-      filename = loc->u.filename;
+      dw2_line = loc->line;
+      dw2_filename = loc->u.filename;
     }
 
   if (linkrelax)
     {
-      static int label_num = 0;
       char name[32];
 
       /* Use a non-fake name for the line number location,
@@ -715,10 +715,12 @@ assign_file_to_slot (unsigned int i, const char *file, unsigned int dir)
    Returns the slot number allocated to that filename or -1
    if there was a problem.  */
 
+static int last_used;
+static int last_used_dir_len;
+
 static signed int
 allocate_filenum (const char * pathname)
 {
-  static signed int last_used = -1, last_used_dir_len = 0;
   const char *file;
   size_t dir_len;
   unsigned int i, dir;
@@ -3089,6 +3091,10 @@ dwarf2_init (void)
   current.u.view = NULL;
   force_reset_view = NULL;
   view_assert_failed = NULL;
+  dw2_line = -1;
+  dw2_filename = NULL;
+  label_num = 0;
+  last_used = -1;
 
   /* Select the default CIE version to produce here.  The global
      starts with a value of -1 and will be modified to a valid value

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-14  2:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14  2:04 gas/dwarf2dbg.c init more statics Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).