diff options
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 7 | ||||
-rw-r--r-- | binutils/objdump.c | 34 | ||||
-rw-r--r-- | binutils/readelf.c | 7 |
3 files changed, 38 insertions, 10 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0007863a3e..74d22edf99 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2010-07-03 Cary Coutant <ccoutant@google.com> + + * objdump.c (load_specific_debug_section): Decompress section contents + before applying relocations. + * readelf.c (load_specific_debug_section): Update section size after + decompression. + 2010-06-29 Alan Modra <amodra@gmail.com> PR binutils/3166 diff --git a/binutils/objdump.c b/binutils/objdump.c index 2a419b7a1a..f94dee968e 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -2205,14 +2205,8 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, section->size = bfd_get_section_size (sec); section->start = (unsigned char *) xmalloc (section->size); - if (is_relocatable && debug_displays [debug].relocate) - ret = bfd_simple_get_relocated_section_contents (abfd, - sec, - section->start, - syms) != NULL; - else - ret = bfd_get_section_contents (abfd, sec, section->start, 0, - section->size); + ret = bfd_get_section_contents (abfd, sec, section->start, 0, + section->size); if (! ret) { @@ -2234,6 +2228,30 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, section->size = size; } + if (is_relocatable && debug_displays [debug].relocate) + { + /* We want to relocate the data we've already read (and + decompressed), so we store a pointer to the data in + the bfd_section, and tell it that the contents are + already in memory. */ + sec->contents = section->start; + sec->flags |= SEC_IN_MEMORY; + sec->size = section->size; + + ret = bfd_simple_get_relocated_section_contents (abfd, + sec, + section->start, + syms) != NULL; + + if (! ret) + { + free_debug_section (debug); + printf (_("\nCan't get contents for section '%s'.\n"), + section->name); + return 0; + } + } + return 1; } diff --git a/binutils/readelf.c b/binutils/readelf.c index d4f47ca731..1c3cb8b286 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -9962,8 +9962,11 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, return 0; if (section_is_compressed) - if (! uncompress_section_contents (§ion->start, §ion->size)) - return 0; + { + if (! uncompress_section_contents (§ion->start, §ion->size)) + return 0; + sec->sh_size = section->size; + } if (debug_displays [debug].relocate) apply_relocations ((FILE *) file, sec, section->start); |