Fix a bug in objcopy/strip's ability to merge notes in multiple same-named sections.

* objcopy.c (copy_object): Compare input and output sections by
	pointer rather than name.
This commit is contained in:
Nick Clifton 2020-10-06 15:49:40 +01:00
parent 3089759191
commit 0ec992e664
2 changed files with 7 additions and 4 deletions

View 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)