This is the mail archive of the 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]

Commit: objcopy: Support merging of notes without SHF_GNU_BUILD_NOTE set.

Hi Guys,

  I am applying the patch below to allow objcopy's new note merging
  feature to work with sections that do not have
  the SHF_GNU_BUILD_NOTE flag set.  This is to support the generation of
  these notes by older versions of GAS, versions which are unable to set
  OS specific section flags.


2017-03-02  Nick Clifton  <>

	* objcopy.c (is_merged_note_section): Support build note sections
	without the SHF_GNU_BUILD_NOTE section flag set.
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]