diff options
author | Alan Modra <amodra@gmail.com> | 2007-10-24 02:27:15 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2007-10-24 02:27:15 +0000 |
commit | 20737c135dddf874ee65b3a210c8943a8d711154 (patch) | |
tree | 4ebf6b4e090f690340c723c369b85b3ddd62ac04 /binutils/readelf.c | |
parent | dc29b2f9c8ca62651276a543aff399f823f82e86 (diff) | |
download | gdb-20737c135dddf874ee65b3a210c8943a8d711154.zip gdb-20737c135dddf874ee65b3a210c8943a8d711154.tar.gz gdb-20737c135dddf874ee65b3a210c8943a8d711154.tar.bz2 |
* readelf.c (process_program_headers): Use dynamic segment unless
dynamic section is found.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c index e550f6f..5ea766d 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -3530,6 +3530,11 @@ process_program_headers (FILE *file) if (dynamic_addr) error (_("more than one dynamic segment\n")); + /* By default, assume that the .dynamic section is the first + section in the DYNAMIC segment. */ + dynamic_addr = segment->p_offset; + dynamic_size = segment->p_filesz; + /* Try to locate the .dynamic section. If there is a section header table, we can easily locate it. */ if (section_headers != NULL) @@ -3544,23 +3549,21 @@ process_program_headers (FILE *file) } if (sec->sh_type == SHT_NOBITS) - break; + { + dynamic_size = 0; + break; + } dynamic_addr = sec->sh_offset; dynamic_size = sec->sh_size; if (dynamic_addr < segment->p_offset || dynamic_addr > segment->p_offset + segment->p_filesz) - warn (_("the .dynamic section is not contained within the dynamic segment\n")); + warn (_("the .dynamic section is not contained" + " within the dynamic segment\n")); else if (dynamic_addr > segment->p_offset) - warn (_("the .dynamic section is not the first section in the dynamic segment.\n")); - } - else - { - /* Otherwise, we can only assume that the .dynamic - section is the first section in the DYNAMIC segment. */ - dynamic_addr = segment->p_offset; - dynamic_size = segment->p_filesz; + warn (_("the .dynamic section is not the first section" + " in the dynamic segment.\n")); } break; |