Author: Description: Description: Fix ld corrupt build ID generation Author: Nick Clifton Upstream status: Taken from Fedora (BZ 501582) --- a/bfd/compress.c +++ b/bfd/compress.c @@ -174,7 +174,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; need_free = TRUE; --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1158,6 +1158,24 @@ 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;