]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
tail recursion in _bfd_elf_link_hide_symbol
authorAlan Modra <amodra@gmail.com>
Tue, 9 Dec 2025 07:25:53 +0000 (17:55 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 9 Dec 2025 09:47:41 +0000 (20:17 +1030)
We can clear the flags first if no backend hide_symbol function tests
or sets them, which is true.

* elflink.c (_bfd_elf_link_hide_symbol): Clear flags before
calling elf_backend_hide_symbol, to enable tail recursion.

bfd/elflink.c

index 39fac0639a0c8009c0a6b83d6cdedadb5ce7e6ea..3f60dba1fef8f0e08ba27f347bb639ed7366abbc 100644 (file)
@@ -8368,14 +8368,12 @@ _bfd_elf_link_hide_symbol (bfd *output_bfd,
 {
   if (is_elf_hash_table (info->hash))
     {
-      const struct elf_backend_data *bed
-       = get_elf_backend_data (output_bfd);
-      struct elf_link_hash_entry *eh
-       = (struct elf_link_hash_entry *) h;
-      bed->elf_backend_hide_symbol (info, eh, true);
+      const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
+      struct elf_link_hash_entry *eh = (struct elf_link_hash_entry *) h;
       eh->def_dynamic = 0;
       eh->ref_dynamic = 0;
       eh->dynamic_def = 0;
+      bed->elf_backend_hide_symbol (info, eh, true);
     }
 }