This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: binutils testsuite pr21231b


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.
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]