[binutils-gdb] tail recursion in _bfd_elf_link_hide_symbol

Alan Modra amodra@sourceware.org
Tue Dec 9 09:48:16 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b1507ceb53d16c6db45a3aeba89d1072fc3c40dc

commit b1507ceb53d16c6db45a3aeba89d1072fc3c40dc
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Dec 9 17:55:53 2025 +1030

    tail recursion in _bfd_elf_link_hide_symbol
    
    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.

Diff:
---
 bfd/elflink.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 39fac0639a0..3f60dba1fef 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -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);
     }
 }


More information about the Binutils-cvs mailing list