diff options
author | Nick Clifton <nickc@redhat.com> | 2011-02-08 09:40:05 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2011-02-08 09:40:05 +0000 |
commit | 82f2dbf73d32c8c82e62d2073a99da8b1ec03fa1 (patch) | |
tree | 3005705c64e9bb89aa75c953be12568983265bf9 /binutils | |
parent | 84ced98a310603805f69d4d6616e02a196232438 (diff) | |
download | gdb-82f2dbf73d32c8c82e62d2073a99da8b1ec03fa1.zip gdb-82f2dbf73d32c8c82e62d2073a99da8b1ec03fa1.tar.gz gdb-82f2dbf73d32c8c82e62d2073a99da8b1ec03fa1.tar.bz2 |
PR binutils/12467
* readelf.c (process_program_headers): Issue a warning if there
are no program headers but the file header has a non-zero program
header offset.
(process_section_headers): Issue a warning if there are no section
headers but the file header has a non-zero section header offset.
(process_section_groups): Reword the no section message so that it
can be distinguished from the one issued by process_section_headers.
* elf.c (assign_file_positions_for_load_sections): Set the program
header offset and entry size to zero if there are no program
headers.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 11 | ||||
-rw-r--r-- | binutils/readelf.c | 14 |
2 files changed, 22 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index bab4756..4a72f3d 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,14 @@ +2011-02-08 Nick Clifton <nickc@redhat.com> + + PR binutils/12467 + * readelf.c (process_program_headers): Issue a warning if there + are no program headers but the file header has a non-zero program + header offset. + (process_section_headers): Issue a warning if there are no section + headers but the file header has a non-zero section header offset. + (process_section_groups): Reword the no section message so that it + can be distinguished from the one issued by process_section_headers. + 2011-01-26 Jan Kratochvil <jan.kratochvil@redhat.com> Doug Evans <dje@google.com> diff --git a/binutils/readelf.c b/binutils/readelf.c index af1a002..0607d89 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -3638,7 +3638,11 @@ process_program_headers (FILE * file) if (elf_header.e_phnum == 0) { - if (do_segments) + /* PR binutils/12467. */ + if (elf_header.e_phoff != 0) + warn (_("possibly corrupt ELF header - it has a non-zero program" + " header offset, but no program headers")); + else if (do_segments) printf (_("\nThere are no program headers in this file.\n")); return 0; } @@ -4377,7 +4381,11 @@ process_section_headers (FILE * file) if (elf_header.e_shnum == 0) { - if (do_sections) + /* PR binutils/12467. */ + if (elf_header.e_shoff != 0) + warn (_("possibly corrupt ELF file header - it has a non-zero" + " section header offset, but no section headers\n")); + else if (do_sections) printf (_("\nThere are no sections in this file.\n")); return 1; @@ -4860,7 +4868,7 @@ process_section_groups (FILE * file) if (elf_header.e_shnum == 0) { if (do_section_groups) - printf (_("\nThere are no sections in this file.\n")); + printf (_("\nThere are no sections to group in this file.\n")); return 1; } |