69 lines
2.0 KiB
Diff
69 lines
2.0 KiB
Diff
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.
|
|
|
|
===================================================================
|
|
RCS file: /cvs/src/src/bfd/elfcode.h,v
|
|
retrieving revision 1.109
|
|
retrieving revision 1.110
|
|
diff -u -r1.109 -r1.110
|
|
--- src/bfd/elfcode.h 2011/06/06 01:26:01 1.109
|
|
+++ src/bfd/elfcode.h 2011/12/14 11:50:13 1.110
|
|
@@ -1097,8 +1097,28 @@
|
|
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;
|
|
===================================================================
|
|
RCS file: /cvs/src/src/bfd/compress.c,v
|
|
retrieving revision 1.9
|
|
retrieving revision 1.10
|
|
diff -u -r1.9 -r1.10
|
|
--- src/bfd/compress.c 2011/04/11 04:08:12 1.9
|
|
+++ src/bfd/compress.c 2011/12/14 11:50:13 1.10
|
|
@@ -181,7 +181,7 @@
|
|
case COMPRESS_SECTION_NONE:
|
|
if (p == NULL)
|
|
{
|
|
- p = (bfd_byte *) bfd_malloc (sz);
|
|
+ p = (bfd_byte *) bfd_zmalloc (sz);
|
|
if (p == NULL)
|
|
return FALSE;
|
|
}
|
|
@@ -221,7 +221,7 @@
|
|
if (!ret)
|
|
goto fail_compressed;
|
|
|
|
- uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
|
|
+ uncompressed_buffer = (bfd_byte *) bfd_zmalloc (uncompressed_size);
|
|
if (uncompressed_buffer == NULL)
|
|
goto fail_compressed;
|
|
|