Automatic date update in version.in
[binutils-gdb.git] / bfd / som.c
index 656ded96b697197e00c78a964a3bc10edaa5ff27..d53a3b90b0244fa703955045489144d1190cd2df 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -1,5 +1,5 @@
 /* bfd back-end for HP PA-RISC SOM objects.
-   Copyright (C) 1990-2021 Free Software Foundation, Inc.
+   Copyright (C) 1990-2022 Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
    University of Utah.
@@ -4740,7 +4740,7 @@ som_slurp_symbol_table (bfd *abfd)
          goto error_return;
        }
       sym->symbol.value = bfd_getb32 (bufp->symbol_value);
-      sym->symbol.section = 0;
+      sym->symbol.section = NULL;
       sym->symbol.flags = 0;
 
       switch (symbol_type)
@@ -4800,6 +4800,10 @@ som_slurp_symbol_table (bfd *abfd)
          sym->symbol.section = bfd_section_from_som_symbol (abfd, bufp);
          sym->symbol.value -= sym->symbol.section->vma;
          break;
+
+       default:
+         sym->symbol.section = bfd_und_section_ptr;
+         break;
        }
 
       /* Check for a weak symbol.  */
@@ -5848,6 +5852,11 @@ som_decode_symclass (asymbol *symbol)
 {
   char c;
 
+  /* If the symbol did not have a scope specified,
+     then it will not have associated section.  */
+  if (symbol == NULL || symbol->section == NULL)
+    return '?';
+
   if (bfd_is_com_section (symbol->section))
     return 'C';
   if (bfd_is_und_section (symbol->section))