]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ctfc: get rid of the static variable in ctf_list_add_ctf_vars ()
authorIndu Bhagat <indu.bhagat@oracle.com>
Thu, 14 Apr 2022 17:00:25 +0000 (10:00 -0700)
committerIndu Bhagat <indu.bhagat@oracle.com>
Thu, 14 Apr 2022 17:00:25 +0000 (10:00 -0700)
2022-04-14  Indu Bhagat  <indu.bhagat@oracle.com>

gcc/ChangeLog:

* ctfc.h (struct ctf_container): Introduce a new member.
* ctfout.cc (ctf_list_add_ctf_vars): Use it instead of static
variable.

gcc/ctfc.h
gcc/ctfout.cc

index 18c93c802a067fc1d9e2ca2f9f7dabb185bb907f..4ce756c728a74b807c331f941435e96c37b04b6a 100644 (file)
@@ -301,6 +301,8 @@ typedef struct GTY (()) ctf_container
   /* List of pre-processed CTF Variables.  CTF requires that the variables
      appear in the sorted order of their names.  */
   ctf_dvdef_t ** GTY ((length ("0"))) ctfc_vars_list;
+  /* Count of pre-processed CTF Variables in the list.  */
+  uint64_t ctfc_vars_list_count;
   /* List of pre-processed CTF types.  CTF requires that a shared type must
      appear before the type that uses it.  For the compiler, this means types
      are emitted in sorted order of their type IDs.  */
index a23d37758019b95700ec1f387c466995969da31d..28a873b2027d64a9004ee8865c78113431f64f47 100644 (file)
@@ -173,9 +173,7 @@ ctf_calc_num_vbytes (ctf_dtdef_ref ctftype)
 static void
 ctf_list_add_ctf_vars (ctf_container_ref ctfc, ctf_dvdef_ref var)
 {
-  /* FIXME - static may not fly with multiple CUs.  */
-  static int num_vars_added = 0;
-  ctfc->ctfc_vars_list[num_vars_added++] = var;
+  ctfc->ctfc_vars_list[ctfc->ctfc_vars_list_count++] = var;
 }
 
 /* Initialize the various sections and labels for CTF output.  */