Fix a bug in objcopy/strip's ability to merge notes in multiple same-named sections.
authorNick Clifton <nickc@redhat.com>
Tue, 6 Oct 2020 14:49:40 +0000 (15:49 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 6 Oct 2020 14:49:40 +0000 (15:49 +0100)
* objcopy.c (copy_object): Compare input and output sections by
pointer rather than name.

binutils/ChangeLog
binutils/objcopy.c

index f5411e3fb3ab998d6efdf0de114d1cf8e7d79d6c..b751eeec5e21cf85e7ea21b8b76ae98e43592548 100644 (file)
@@ -1,3 +1,8 @@
+2020-10-06  Nick Clifton  <nickc@redhat.com>
+
+       * objcopy.c (copy_object): Compare input and output sections by
+       pointer rather than name.
+
 2020-10-05  Nick Clifton  <nickc@redhat.com>
 
        PR 26698
index 1a6fc8a4f59b0358ba96e00ef1105543591a652a..d777d740cb77032e0be23d1cfafe0b0be83eaf29 100644 (file)
@@ -3322,14 +3322,12 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
          /* It is likely that output sections are in the same order
             as the input sections, but do not assume that this is
             the case.  */
-         if (strcmp (bfd_section_name (merged->sec),
-                     bfd_section_name (osec)) != 0)
+         if (merged->sec->output_section != osec)
            {
              for (merged = merged_note_sections;
                   merged != NULL;
                   merged = merged->next)
-               if (strcmp (bfd_section_name (merged->sec),
-                           bfd_section_name (osec)) == 0)
+               if (merged->sec->output_section == osec)
                  break;
 
              if (merged == NULL)