binutils/binutils-2.22-build-id.patch

48 lines
1.3 KiB
Diff

--- bfd/compress.c.jj 2010-12-24 11:40:19.000000000 +0100
+++ bfd/compress.c 2011-01-28 15:40:19.869777126 +0100
@@ -174,7 +174,7 @@ bfd_get_full_section_contents (bfd *abfd
case COMPRESS_SECTION_NONE:
if (p == NULL)
{
- p = (bfd_byte *) bfd_malloc (sz);
+ p = (bfd_byte *) bfd_zmalloc (sz);
if (p == NULL)
return FALSE;
}
@@ -214,7 +214,7 @@ bfd_get_full_section_contents (bfd *abfd
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;
--- bfd/elfcode.h.jj 2010-12-31 03:43:21.000000000 +0100
+++ bfd/elfcode.h 2011-01-28 15:34:39.055388479 +0100
@@ -1158,6 +1158,24 @@ elf_checksum_contents (bfd *abfd,
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;