]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: alpha: Properly handle local weak undefined symbols
authorAlan Modra <amodra@gmail.com>
Wed, 27 May 2026 12:07:31 +0000 (21:37 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 27 May 2026 12:45:15 +0000 (22:15 +0930)
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.

bfd/elf64-alpha.c

index 594bfe9a80e1b8c7ee958b99c4ec1ebf3641d7ca..8cc70610c5908f6a3bc8466d1c783bc9aa3f2d46 100644 (file)
@@ -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.  */