[binutils-gdb] Re: alpha: Properly handle local weak undefined symbols

Alan Modra via Binutils-cvs <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5dd77fc95236da16036d9cbbe0e6f53f0ad7ac3b

commit 5dd77fc95236da16036d9cbbe0e6f53f0ad7ac3b
Author: Alan Modra <[email protected]>
Date:   Wed May 27 21:37:31 2026 +0930

    Re: alpha: Properly handle local weak undefined symbols
    
    asan complains "runtime error: member access within null pointer"
    for &h->root with NULL h, which is annoying since &h->root is the
    same address as h, causing
    alpha-linux-gnu  +FAIL: TLS -fpic -shared
    alpha-linux-gnu  +FAIL: TLS -fpic and -fno-pic exec
    alpha-linux-gnu  +FAIL: TLS -fpic and -fno-pic exec -relax
    
            * elf64-alpha.c (elf64_alpha_relocate_section): Fix asan
            complaint.

Diff:
---
 bfd/elf64-alpha.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 594bfe9a80e..8cc70610c59 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -4648,7 +4648,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 		 input_bfd, h->root.root.root.string);
 	      ret_val = false;
 	    }
-	  else if (elf_link_local_undefweak_p (&h->root, info))
+	  else if (elf_link_local_undefweak_p (h ? &h->root : NULL, info))
 	    /* NB: The local undefined TLS symbol address isn't usable
 	       since it isn't mapped to any TLS storage.  Set it to 0
 	       to avoid relocation overflow.  */
@@ -4676,7 +4676,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 		value = 0;
 	      else
 		{
-		  if (elf_link_local_undefweak_p (&h->root, info))
+		  if (elf_link_local_undefweak_p (h ? &h->root : NULL, info))
 		    /* NB: The local undefined TLS symbol address isn't
 		       usable since it isn't mapped to any TLS storage.
 		       Set it to 0 to avoid relocation overflow.  */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.