]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Support merging build notes in sections without the SHF_GNU_BUILD_NOTE flag set.
authorNick Clifton <nickc@redhat.com>
Thu, 2 Mar 2017 17:10:20 +0000 (17:10 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 2 Mar 2017 17:10:20 +0000 (17:10 +0000)
* objcopy.c (is_merged_note_section): Support build note sections
without the SHF_GNU_BUILD_NOTE section flag set.

binutils/ChangeLog
binutils/objcopy.c

index dc93395aa4d47502ae57ad899ddd6b3df3a655eb..4ed3bb0804fcffc6e8d4430dbcf7e0ee2984922f 100644 (file)
@@ -2,6 +2,8 @@
 
        * readelf.c (print_gnu_build_attribute_description): Use global
        symbols for OPEN attributes if at all possible.
+       * objcopy.c (is_merged_note_section): Support build note sections
+       without the SHF_GNU_BUILD_NOTE section flag set.
 
 2017-03-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
index baf69907c5fd2d1189138565bd363d1953297cfe..868f122e174254fb6713daafec83c95bd8a00205 100644 (file)
@@ -1217,7 +1217,11 @@ is_merged_note_section (bfd * abfd, asection * sec)
       && elf_section_data (sec)->this_hdr.sh_type == SHT_NOTE
       /* FIXME: We currently only support merging GNU_BUILD_NOTEs.
         We should add support for more note types.  */
-      && elf_section_data (sec)->this_hdr.sh_flags & SHF_GNU_BUILD_NOTE)
+      && ((elf_section_data (sec)->this_hdr.sh_flags & SHF_GNU_BUILD_NOTE) != 0
+         /* Old versions of GAS (prior to 2.27) could not set the section
+            flags to OS-specific values, so we also accept sections with the
+            expected name.  */
+         || (strcmp (sec->name, GNU_BUILD_ATTRS_SECTION_NAME) == 0)))
     return TRUE;
 
   return FALSE;