aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-10-06 15:49:40 +0100
committerNick Clifton <nickc@redhat.com>2020-10-06 15:49:40 +0100
commit0ec992e6647c00fc234cdf4c11732b6711b024af (patch)
treea855ae9f9899fdfbea8a016114b53fe827a5f214 /binutils/objcopy.c
parent308975919152fbf301861d88e2da9b522e3cf112 (diff)
downloadgdb-0ec992e6647c00fc234cdf4c11732b6711b024af.zip
gdb-0ec992e6647c00fc234cdf4c11732b6711b024af.tar.gz
gdb-0ec992e6647c00fc234cdf4c11732b6711b024af.tar.bz2
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.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 1a6fc8a..d777d74 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -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)