aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2014-06-26 09:32:25 +0100
committerNick Clifton <nickc@redhat.com>2014-06-26 09:34:24 +0100
commitdf565f326e62eacf41fb880f1acc65b9fdb5052c (patch)
tree90b29ab456d2c6f81e90b51bad06c268e86ffb40 /binutils
parentefc889c1a86826b6619485bf379467daaea1ad3e (diff)
downloadgdb-df565f326e62eacf41fb880f1acc65b9fdb5052c.zip
gdb-df565f326e62eacf41fb880f1acc65b9fdb5052c.tar.gz
gdb-df565f326e62eacf41fb880f1acc65b9fdb5052c.tar.bz2
Fixes part of a problem reading deliberately non-conforming ELF binaries - where a
note segment is present but no note section. * readelf.c (process_note_sections): If there are no note sections try processing note segments instead.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c14
2 files changed, 16 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 71eca31..cc698cb 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/readelf.c b/binutils/readelf.c
index af6463e..d85786e 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -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;
}