From: "Joseph S. Myers" <joseph@codesourcery.com>
To: binutils@sourceware.org
Subject: Unknown attribute handling bug fix
Date: Thu, 04 Nov 2010 15:51:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.1011041550110.3062@digraph.polyomino.org.uk> (raw)
This patch fixes a pre-existing bug in the generic merging of unknown
object attributes that I found in the course of implementing and
testing the C6X support for such merging: inappropriate use of pointer
comparison for string attributes. OK to commit? (Test coverage for
this fix is provided by ld-tic6x/attr-unknown-3.d, added by the
following C6X-specific patch I'll post shortly.)
2010-11-04 Joseph Myers <joseph@codesourcery.com>
* elf-attrs.c (_bfd_elf_merge_unknown_attribute_low,
_bfd_elf_merge_unknown_attribute_list): Correct test for matching
string attributes.
Index: bfd/elf-attrs.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-attrs.c,v
retrieving revision 1.13
diff -u -p -r1.13 elf-attrs.c
--- bfd/elf-attrs.c 4 Nov 2010 11:35:00 -0000 1.13
+++ bfd/elf-attrs.c 4 Nov 2010 15:41:46 -0000
@@ -613,7 +613,7 @@ _bfd_elf_merge_unknown_attribute_low (bf
/* Only pass on attributes that match in both inputs. */
if (in_attr[tag].i != out_attr[tag].i
- || in_attr[tag].s != out_attr[tag].s
+ || (in_attr[tag].s == NULL) != (out_attr[tag].s == NULL)
|| (in_attr[tag].s != NULL && out_attr[tag].s != NULL
&& strcmp (in_attr[tag].s, out_attr[tag].s) != 0))
{
@@ -673,7 +673,7 @@ _bfd_elf_merge_unknown_attribute_list (b
/* Only pass on attributes that match in both inputs. */
if (in_list->attr.i != out_list->attr.i
- || in_list->attr.s != out_list->attr.s
+ || (in_list->attr.s == NULL) != (out_list->attr.s == NULL)
|| (in_list->attr.s && out_list->attr.s
&& strcmp (in_list->attr.s, out_list->attr.s) != 0))
{
--
Joseph S. Myers
joseph@codesourcery.com
next reply other threads:[~2010-11-04 15:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-04 15:51 Joseph S. Myers [this message]
2010-11-05 5:37 ` Alan Modra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.1011041550110.3062@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).