aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-12-14 11:50:13 +0000
committerNick Clifton <nickc@redhat.com>2011-12-14 11:50:13 +0000
commit4d48ecf313d597450f4540e6d1eeb0ac4c56866c (patch)
tree16a54f7169d4222be7723ccf91a458df89798dd8 /bfd/elfcode.h
parenta455111938d5abb9ed13004b040e831f836fdc23 (diff)
downloadgdb-4d48ecf313d597450f4540e6d1eeb0ac4c56866c.zip
gdb-4d48ecf313d597450f4540e6d1eeb0ac4c56866c.tar.gz
gdb-4d48ecf313d597450f4540e6d1eeb0ac4c56866c.tar.bz2
PR ld/12451
* elfcode.h (elf_checksum_contents): Read in the section's contents if they are not already available. * compress.c (bfd_get_full_section_contents): Use zmalloc to allocate the buffers so that excess bytes are guaranteed to be zero.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index b7e0226..f5727fe 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1097,8 +1097,28 @@ elf_checksum_contents (bfd *abfd,
elf_swap_shdr_out (abfd, &i_shdr, &x_shdr);
(*process) (&x_shdr, sizeof x_shdr, arg);
+ /* PR ld/12451:
+ Process the section's contents; reading them in if necessary. */
if (i_shdr.contents)
(*process) (i_shdr.contents, i_shdr.sh_size, arg);
+ else
+ {
+ asection *sec;
+
+ sec = bfd_section_from_elf_index (abfd, count);
+ if (sec != NULL)
+ {
+ if (sec->contents == NULL)
+ {
+ /* Force rereading from file. */
+ sec->flags &= ~SEC_IN_MEMORY;
+ if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
+ continue;
+ }
+ if (sec->contents != NULL)
+ (*process) (sec->contents, i_shdr.sh_size, arg);
+ }
+ }
}
return TRUE;