public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Alan Modra <amodra@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: binutils testsuite pr21231b
Date: Tue, 11 Apr 2017 16:07:00 -0000	[thread overview]
Message-ID: <CAMe9rOruUFAcP8k9G9cTjWoUjmZEbnBZ7LiK9W4+9vNb7YViLw@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOq=BhJQ9dbi5GRsEWMJW9R=c0jLBmfDcHe0TygTEQfCBQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1773 bytes --]

On Mon, Apr 10, 2017 at 5:08 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Apr 10, 2017 at 4:51 PM, Alan Modra <amodra@gmail.com> wrote:
>> On Mon, Apr 10, 2017 at 08:57:42AM -0700, H.J. Lu wrote:
>>> On Sun, Apr 9, 2017 at 9:15 PM, Alan Modra <amodra@gmail.com> wrote:
>>> > You can't emit errors/warnings in _bfd_elf_parse_gnu_properties except
>>> > for those that will occur for all targets.  Please fix.
>>> >
>>>
>>> Here is a patch to make generic ELF target vectors the last resort.
>>
>> Not a good idea.  It sets a bad precedent that the target vector order
>> can be changed to suit poorly written code.  Next thing you'll be
>> wanting x86_64_elf64_fbsd_vec to sort before x86_64_elf64_vec, or
>> someone else will want something similar for other targets, and we'll
>> have breakage if the vector order is changed.
>>
>
> BFD shouldn't try generic target vector before real one and config.bfd
> has
>
> # If we support any ELF target, then automatically add support for the
> # generic ELF targets.  This permits an objdump with some ELF support
> # to be used on an arbitrary ELF file for anything other than
> # relocation information.
> case "${targ_defvec} ${targ_selvecs}" in
>   *elf64* | *mips_elf32_n*)
>     targ_selvecs="${targ_selvecs} elf64_le_vec elf64_be_vec
> elf32_le_vec elf32_be_vec"
>     ;;
>   *elf32*)
>     targ_selvecs="${targ_selvecs} elf32_le_vec elf32_be_vec"
>     ;;
> esac
>
> If generic ELF target vectors are moved first, we may run into similar
> problems.
>
> As for x86_64_elf64_fbsd_vec vs x86_64_elf64_vec,  either there is
> already an issue, which we have been living with, or there is no issue
> at all.
>

Here is a patch to skip processor-specific GNU program properties with
generic ELF target vector.

-- 
H.J.

[-- Attachment #2: 0001-Ignore-processor-specific-GNU-program-properties.patch --]
[-- Type: text/x-patch, Size: 1267 bytes --]

From 4925704145f97d1cc2740cd0365ad02693d7caa7 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 11 Apr 2017 09:02:26 -0700
Subject: [PATCH] Ignore processor-specific GNU program properties

Skip processor-specific GNU program properties with generic ELF target
vector.  They should be handled by the matching ELF target vector.

	* elf-properties.c (_bfd_elf_parse_gnu_properties): Ignore
	processor-specific properties with generic ELF target vector.
---
 bfd/elf-properties.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index a0456f8..04ef536 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -113,7 +113,15 @@ bad_size:
 
       if (type >= GNU_PROPERTY_LOPROC)
 	{
-	  if (type < GNU_PROPERTY_LOUSER && bed->parse_gnu_properties)
+	  if (bed->elf_machine_code == EM_NONE)
+	    {
+	      /* Ignore processor-specific properties with generic ELF
+		 target vector.  They should be handled by the matching
+		 ELF target vector.  */
+	      goto next;
+	    }
+	  else if (type < GNU_PROPERTY_LOUSER
+		   && bed->parse_gnu_properties)
 	    {
 	      enum elf_property_kind kind
 		= bed->parse_gnu_properties (abfd, type, ptr, datasz);
-- 
2.9.3


  reply	other threads:[~2017-04-11 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10  4:15 Alan Modra
2017-04-10 15:57 ` H.J. Lu
2017-04-10 23:51   ` Alan Modra
2017-04-11  0:08     ` H.J. Lu
2017-04-11 16:07       ` H.J. Lu [this message]
2017-04-11 21:49         ` 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=CAMe9rOruUFAcP8k9G9cTjWoUjmZEbnBZ7LiK9W4+9vNb7YViLw@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=amodra@gmail.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).