]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end/114599 - fix bitmap allocation for check_ifunc_callee_symtab_nodes
authorRichard Biener <rguenther@suse.de>
Fri, 5 Apr 2024 08:16:41 +0000 (10:16 +0200)
committerH.J. Lu <(no_default)>
Mon, 15 Apr 2024 11:26:13 +0000 (04:26 -0700)
There's no default bitmap obstack during global CTORs, so allocate the
bitmap locally.

PR middle-end/114599
PR gcov-profile/114115
* symtab.cc (ifunc_ref_map): Do not use auto_bitmap.
(is_caller_ifunc_resolver): Optimize bitmap_bit_p/bitmap_set_bit
pair.
(symtab_node::check_ifunc_callee_symtab_nodes): Properly
allocate ifunc_ref_map here.

(cherry picked from commit 9ab8fdfeef5b1a47b358e08a98177b2fad65fed9)

gcc/symtab.cc

index 01502e76fc856b3d41e06dc2691ddd5c4e3a2770..68a537f3fe5085b6b61d8de2807d774058f91548 100644 (file)
@@ -1382,7 +1382,7 @@ check_ifunc_resolver (cgraph_node *node, void *data)
   return false;
 }
 
-static auto_bitmap ifunc_ref_map;
+static bitmap ifunc_ref_map;
 
 /* Return true if any caller of NODE is an ifunc resolver.  */
 
@@ -1403,9 +1403,8 @@ is_caller_ifunc_resolver (cgraph_node *node)
 
       /* Skip if it has been visited.  */
       unsigned int uid = e->caller->get_uid ();
-      if (bitmap_bit_p (ifunc_ref_map, uid))
+      if (!bitmap_set_bit (ifunc_ref_map, uid))
        continue;
-      bitmap_set_bit (ifunc_ref_map, uid);
 
       if (is_caller_ifunc_resolver (e->caller))
        {
@@ -1436,6 +1435,9 @@ symtab_node::check_ifunc_callee_symtab_nodes (void)
 {
   symtab_node *node;
 
+  bitmap_obstack_initialize (NULL);
+  ifunc_ref_map = BITMAP_ALLOC (NULL);
+
   FOR_EACH_SYMBOL (node)
     {
       cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
@@ -1454,7 +1456,8 @@ symtab_node::check_ifunc_callee_symtab_nodes (void)
        cnode->called_by_ifunc_resolver = true;
     }
 
-  bitmap_clear (ifunc_ref_map);
+  BITMAP_FREE (ifunc_ref_map);
+  bitmap_obstack_release (NULL);
 }
 
 /* Verify symbol table for internal consistency.  */