This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Support merging build notes in sections without the SHF_GNU_BUILD_NOTE flag set.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=05ed43104ef2c3f75779438111e2913dbd4555a6

commit 05ed43104ef2c3f75779438111e2913dbd4555a6
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Mar 2 17:10:20 2017 +0000

    Support merging build notes in sections without the SHF_GNU_BUILD_NOTE flag set.
    
    	* objcopy.c (is_merged_note_section): Support build note sections
    	without the SHF_GNU_BUILD_NOTE section flag set.

Diff:
---
 binutils/ChangeLog | 2 ++
 binutils/objcopy.c | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index dc93395..4ed3bb0 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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>
 
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index baf6990..868f122 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]