Fixes part of a problem reading deliberately non-conforming ELF binaries - where a
authorNick Clifton <nickc@redhat.com>
Thu, 26 Jun 2014 08:32:25 +0000 (09:32 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 26 Jun 2014 08:34:24 +0000 (09:34 +0100)
note segment is present but no note section.

* readelf.c (process_note_sections): If there are no note sections
try processing note segments instead.

binutils/ChangeLog
binutils/readelf.c

index 71eca314fa21246c5c9a232ec7740bee030b1a8b..cc698cb0aaf78909e0804c6cdc88e91a1719e1e3 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-26  Nick Clifton  <nickc@redhat.com>
+
+       * readelf.c (process_note_sections): If there are no note sections
+       try processing note segments instead.
+
 2014-06-17  Anton Lavrentiwev  <lavr@ncbi.nim.nih.gov>
 
        PR binutils/16923
index af6463e6ad47e22ec84e5b5588a166d1fc105ae8..d85786e28a1be907cce6f1838a3214a26f677b18 100644 (file)
@@ -14050,15 +14050,23 @@ process_note_sections (FILE * file)
 {
   Elf_Internal_Shdr * section;
   unsigned long i;
+  int n = 0;
   int res = 1;
 
   for (i = 0, section = section_headers;
        i < elf_header.e_shnum && section != NULL;
        i++, section++)
     if (section->sh_type == SHT_NOTE)
-      res &= process_corefile_note_segment (file,
-                                           (bfd_vma) section->sh_offset,
-                                           (bfd_vma) section->sh_size);
+      {
+       res &= process_corefile_note_segment (file,
+                                             (bfd_vma) section->sh_offset,
+                                             (bfd_vma) section->sh_size);
+       n++;
+      }
+
+  if (n == 0)
+    /* Try processing NOTE segments instead.  */
+    return process_corefile_note_segments (file);
 
   return res;
 }