* elfread.c (elf_symtab_read): Handle error return from
[deliverable/binutils-gdb.git] / gdb / elfread.c
index 214197cbfb23db4ada9dffa309724ee3cd03cef9..67ce6086dac7bab19ae37371194a7c8ad0ddb3ce 100644 (file)
@@ -264,12 +264,20 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
   int stripped = (bfd_get_symcount (abfd) == 0);
  
   if (dynamic)
-    storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
+    {
+      storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
+
+      /* Nothing to be done if there is no dynamic symtab.  */
+      if (storage_needed < 0)
+       return;
+    }
   else
-    storage_needed = bfd_get_symtab_upper_bound (abfd);
-  if (storage_needed < 0)
-    error ("Can't read symbols from %s: %s", bfd_get_filename (abfd),
-          bfd_errmsg (bfd_get_error ()));
+    {
+      storage_needed = bfd_get_symtab_upper_bound (abfd);
+      if (storage_needed < 0)
+       error ("Can't read symbols from %s: %s", bfd_get_filename (abfd),
+              bfd_errmsg (bfd_get_error ()));
+    }
   if (storage_needed > 0)
     {
       symbol_table = (asymbol **) xmalloc (storage_needed);
This page took 0.024276 seconds and 4 git commands to generate.