]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
is_target_special_symbol fixes for commit 68bbe1183379
authorAlan Modra <amodra@gmail.com>
Fri, 4 Oct 2024 07:34:59 +0000 (17:04 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 4 Oct 2024 08:17:21 +0000 (17:47 +0930)
* elf.c (_bfd_elf_is_local_label_name): Don't segv on NULL name.
* elf32-v850.c (v850_elf_is_local_label_name): Likewise.
* elfnn-riscv.c (riscv_elf_is_target_special_symbol): Likewise.

bfd/elf.c
bfd/elf32-v850.c
bfd/elfnn-riscv.c

index 39ee641097b357be97392d925603154b6d02dd41..4012d994272183f3c30aae46f1d2a54afcfed6de 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9725,6 +9725,9 @@ bool
 _bfd_elf_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
                              const char *name)
 {
+  if (!name)
+    return false;
+
   /* Normal local symbols start with ``.L''.  */
   if (name[0] == '.' && name[1] == 'L')
     return true;
index 85cbcbc3505f07227412df556fcb6ea73af320fb..8d61ebb6754953606030c39fa0092ceeefce7bf2 100644 (file)
@@ -1933,8 +1933,13 @@ v850_elf_info_to_howto_rela (bfd *abfd,
 static bool
 v850_elf_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
 {
-  return (   (name[0] == '.' && (name[1] == 'L' || name[1] == '.'))
-         || (name[0] == '_' &&  name[1] == '.' && name[2] == 'L' && name[3] == '_'));
+  if (!name)
+    return false;
+  if (name[0] == '.' && (name[1] == 'L' || name[1] == '.'))
+    return true;
+  if (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_')
+    return true;
+  return false;
 }
 
 static bool
index 90ecc276f3161dc5c250b55eb791ee6dba5115a9..4844412a4d45854adf8ce6717d1d307f77ddbde6 100644 (file)
@@ -5610,9 +5610,11 @@ riscv_maybe_function_sym (const asymbol *sym,
 static bool
 riscv_elf_is_target_special_symbol (bfd *abfd, asymbol *sym)
 {
+  if (!sym->name)
+    return false;
   /* PR27584, local and empty symbols.  Since they are usually
      generated for pcrel relocations.  */
-  return (!strcmp (sym->name, "")
+  return (!sym->name[0]
          || _bfd_elf_is_local_label_name (abfd, sym->name)
          /* PR27916, mapping symbols.  */
          || riscv_elf_is_mapping_symbols (sym->name));