summaryrefslogtreecommitdiff
path: root/binutils/patches/128_build_id.patch
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/patches/128_build_id.patch')
-rw-r--r--binutils/patches/128_build_id.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/binutils/patches/128_build_id.patch b/binutils/patches/128_build_id.patch
new file mode 100644
index 0000000..cba02de
--- /dev/null
+++ b/binutils/patches/128_build_id.patch
@@ -0,0 +1,42 @@
+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;