Upload Tizen:Base source
[external/binutils.git] / debian / patches / 128_build_id.patch
1 Author: 
2 Description: Description: Fix ld corrupt build ID generation
3 Author: Nick Clifton
4 Upstream status: Taken from Fedora (BZ 501582)
5 --- a/bfd/compress.c
6 +++ b/bfd/compress.c
7 @@ -174,7 +174,7 @@
8      case COMPRESS_SECTION_NONE:
9        if (p == NULL)
10         {
11 -         p = (bfd_byte *) bfd_malloc (sz);
12 +         p = (bfd_byte *) bfd_zmalloc (sz);
13           if (p == NULL)
14             return FALSE;
15           need_free = TRUE;
16 --- a/bfd/elfcode.h
17 +++ b/bfd/elfcode.h
18 @@ -1158,6 +1158,24 @@
19  
20        if (i_shdr.contents)
21         (*process) (i_shdr.contents, i_shdr.sh_size, arg);
22 +      else
23 +       {
24 +         asection *sec;
25 +
26 +         sec = bfd_section_from_elf_index (abfd, count);
27 +         if (sec != NULL)
28 +           {
29 +             if (sec->contents == NULL)
30 +               {
31 +                 /* Force rereading from file.  */
32 +                 sec->flags &= ~SEC_IN_MEMORY;
33 +                 if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
34 +                   continue;
35 +               }
36 +             if (sec->contents != NULL)
37 +               (*process) (sec->contents, i_shdr.sh_size, arg);
38 +           }
39 +       }
40      }
41  
42    return TRUE;