]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Always try find_dynsym last, also on find_symtab ELF errors.
authorMark Wielaard <mjw@redhat.com>
Fri, 19 Dec 2014 17:19:29 +0000 (18:19 +0100)
committerMark Wielaard <mjw@redhat.com>
Fri, 19 Dec 2014 17:19:29 +0000 (18:19 +0100)
An ELF error during find_symtab might be incomplete shdrs or string table
from ELF images read through elf_from_memory. The phdrs and dynsym should
always be complete.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
libdwfl/ChangeLog
libdwfl/dwfl_module_getdwarf.c

index 3d3edc5f884b0180baf647b86389974a57bee50a..69e59a6fc73e1902d91e0c08d12180e73ad58630 100644 (file)
@@ -1,3 +1,7 @@
+2014-12-19  Mark Wielaard  <mjw@redhat.com>
+
+       * dwfl_module_getdwarf.c (find_symtab): Always try find_dynsym last.
+
 2014-12-19  Mark Wielaard  <mjw@redhat.com>
 
        * elf-from-memory.c (handle_segment): Remove palign sanity check.
index ab9bd48d4cd73dc1df816560852bb43a49923b80..494407dd3595248f28575cf35527a5701b669e4b 100644 (file)
@@ -1084,7 +1084,7 @@ find_symtab (Dwfl_Module *mod)
     {
     elferr:
       mod->symerr = DWFL_E (LIBELF, elf_errno ());
-      goto aux_cleanup;
+      goto aux_cleanup; /* This cleans up some more and tries find_dynsym.  */
     }
 
   /* Cache the data; MOD->syments and MOD->first_global were set above.  */
@@ -1124,6 +1124,9 @@ find_symtab (Dwfl_Module *mod)
          mod->aux_syments = 0;
          elf_end (mod->aux_sym.elf);
          mod->aux_sym.elf = NULL;
+         /* We thought we had something through shdrs, but it failed...
+            Last ditch, look for dynamic symbols without section headers.  */
+         find_dynsym (mod);
          return;
        }