bfd: avoid a crash when debug_section isn't created in XCOFF
authorClément Chigot <clement.chigot@atos.net>
Thu, 29 Jul 2021 12:22:54 +0000 (14:22 +0200)
committerClément Chigot <clement.chigot@atos.net>
Fri, 30 Jul 2021 06:37:15 +0000 (08:37 +0200)
bfd/
* xcofflink.c (bfd_xcoff_size_dynamic_sections):
Add check to know if debug_section is initialized.

bfd/xcofflink.c

index e18efd4381a8d15e03a0d9b7f6de9b6434c0f6f2..a00ae895e4149ef1b17b3d18f22735039d51db30 100644 (file)
@@ -3992,7 +3992,8 @@ bfd_xcoff_size_dynamic_sections (bfd *output_bfd,
        }
     }
 
-  if (info->strip != strip_all)
+  if (info->strip != strip_all
+      && xcoff_hash_table (info)->debug_section != NULL)
     xcoff_hash_table (info)->debug_section->size =
       _bfd_stringtab_size (debug_strtab);