[PATCH 3/3] Improve efficiency of copying section from another tree

Martin Liška mliska@suse.cz
Mon Nov 30 12:16:54 GMT 2020


On 11/13/19 7:29 AM, Strager Neds wrote:
> -/* Worker for set_section.  */
> +void
> +symtab_node::set_section_for_node (const symtab_node &other)
> +{
> +  if (x_section == other.x_section)
> +    return;
> +  if (get_section () && other.get_section ())
> +    gcc_checking_assert (strcmp (get_section (), other.get_section ()) != 0);
> +  release_section_hash_entry (x_section);
> +  if (other.x_section)
> +    x_section = retain_section_hash_entry (other.x_section);
> +  else
> +    x_section = NULL;
> +}
> +
> +/* Workers for set_section.  */
> 
>   bool
> -symtab_node::set_section (symtab_node *n, void *s)
> +symtab_node::set_section_from_string (symtab_node *n, void *s)
>   {
>     n->set_section_for_node ((char *)s);
>     return false;
>   }
> 
> +bool
> +symtab_node::set_section_from_node (symtab_node *n, void *o)
> +{
> +  const symtab_node &other = *static_cast<const symtab_node *> (o);
> +  n->set_section_for_node (other);
> +  return false;
> +}
> +
>   /* Set section of symbol and its aliases.  */

Hello.

Apparently, the patch caused the following regression:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98057

I've got a fix for it, but I would appreciate function comments
for the

void
symtab_node::set_section_for_node (const symtab_node &other)

and
bool
symtab_node::set_section_from_node (symtab_node *n, void *o)

Can you please add it?
Thanks,
Martin




More information about the Gcc-patches mailing list