rpms/binutils/devel binutils-2.17.50.0.12-osabi.patch, NONE, 1.1 binutils.spec, 1.112, 1.113

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Mar 14 09:56:13 UTC 2007


Author: jakub

Update of /cvs/dist/rpms/binutils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv8515

Modified Files:
	binutils.spec 
Added Files:
	binutils-2.17.50.0.12-osabi.patch 
Log Message:
2.17.50.0.12-3

binutils-2.17.50.0.12-osabi.patch:
 elf-bfd.h      |    2 --
 elf.c          |   11 -----------
 elfcode.h      |   49 +++++++++++++++++++++++++++++++++++++++++++++----
 elfxx-target.h |    2 +-
 4 files changed, 46 insertions(+), 18 deletions(-)

--- NEW FILE binutils-2.17.50.0.12-osabi.patch ---
2007-03-13  H.J. Lu  <hongjiu.lu at intel.com>

	PR binutils/3826
	* elf-bfd.h (_bfd_elf_check_osabi): Removed.

	* elf.c (_bfd_elf_check_osabi): Removed.

	* elfcode.h (elf_object_p): Match the ELFOSABI_NONE ELF target
	with any ELF target of the same machine for which we do not
	have a specific backend.

	* elfxx-target.h (elf_backend_object_p): Default to 0.

--- bfd/elf-bfd.h.jj	2007-01-28 11:49:30.000000000 -0500
+++ bfd/elf-bfd.h	2007-03-14 05:28:16.000000000 -0400
@@ -1736,8 +1736,6 @@ extern bfd_boolean _bfd_elf_setup_sectio
 
 extern void _bfd_elf_set_osabi (bfd * , struct bfd_link_info *);
 
-extern bfd_boolean _bfd_elf_check_osabi (bfd *);
-
 extern const bfd_target *bfd_elf32_object_p
   (bfd *);
 extern const bfd_target *bfd_elf32_core_file_p
--- bfd/elf.c.jj	2007-01-28 11:49:30.000000000 -0500
+++ bfd/elf.c	2007-03-14 05:28:31.000000000 -0400
@@ -9135,14 +9135,3 @@ _bfd_elf_set_osabi (bfd * abfd,
 
   i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
 }
-
-bfd_boolean
-_bfd_elf_check_osabi (bfd *abfd)
-{
-  Elf_Internal_Ehdr * i_ehdrp;	/* ELF file header, internal form.  */
-
-  i_ehdrp = elf_elfheader (abfd);
-
-  return (i_ehdrp->e_ident[EI_OSABI]
-	  == get_elf_backend_data (abfd)->elf_osabi);
-}
--- bfd/elfxx-target.h.jj	2007-01-28 11:49:30.000000000 -0500
+++ bfd/elfxx-target.h	2007-03-14 05:29:27.000000000 -0400
@@ -320,7 +320,7 @@
 #define elf_backend_sym_is_global	0
 #endif
 #ifndef elf_backend_object_p
-#define elf_backend_object_p		_bfd_elf_check_osabi
+#define elf_backend_object_p		0
 #endif
 #ifndef elf_backend_symbol_processing
 #define elf_backend_symbol_processing	0
--- bfd/elfcode.h.jj	2006-09-24 11:19:58.000000000 -0400
+++ bfd/elfcode.h	2007-03-14 05:30:17.000000000 -0400
@@ -500,6 +500,8 @@ elf_object_p (bfd *abfd)
   struct bfd_preserve preserve;
   asection *s;
   bfd_size_type amt;
+  const bfd_target *target;
+  const bfd_target * const *target_ptr;
 
   preserve.marker = NULL;
 
@@ -543,10 +545,12 @@ elf_object_p (bfd *abfd)
   if (!bfd_preserve_save (abfd, &preserve))
     goto got_no_match;
 
+  target = abfd->xvec;
+
   /* Allocate an instance of the elf_obj_tdata structure and hook it up to
      the tdata pointer in the bfd.  */
 
-  if (! (*abfd->xvec->_bfd_set_format[bfd_object]) (abfd))
+  if (! (*target->_bfd_set_format[bfd_object]) (abfd))
     goto got_no_match;
   preserve.marker = elf_tdata (abfd);
 
@@ -586,8 +590,6 @@ elf_object_p (bfd *abfd)
       && (ebd->elf_machine_alt2 == 0
 	  || i_ehdrp->e_machine != ebd->elf_machine_alt2))
     {
-      const bfd_target * const *target_ptr;
-
       if (ebd->elf_machine_code != EM_NONE)
 	goto got_wrong_format_error;
 
@@ -628,6 +630,45 @@ elf_object_p (bfd *abfd)
 	goto got_no_match;
     }
 
+  if (ebd->elf_machine_code != EM_NONE
+      && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi)
+    {
+      if (ebd->elf_osabi != ELFOSABI_NONE)
+	goto got_wrong_format_error;
+
+      /* This is an ELFOSABI_NONE ELF target.  Let it match any ELF
+	 target of the compatible machine for which we do not have a
+	 backend with matching ELFOSABI.  */
+      for (target_ptr = bfd_target_vector;
+	   *target_ptr != NULL;
+	   target_ptr++)
+	{
+	  const struct elf_backend_data *back;
+
+	  /* Skip this target and targets with incompatible byte
+	     order.  */
+	  if (*target_ptr == target
+	      || (*target_ptr)->flavour != bfd_target_elf_flavour
+	      || (*target_ptr)->byteorder != target->byteorder
+	      || ((*target_ptr)->header_byteorder
+		  != target->header_byteorder))
+	    continue;
+
+	  back = (const struct elf_backend_data *) (*target_ptr)->backend_data;
+	  if (back->elf_osabi == i_ehdrp->e_ident[EI_OSABI]
+	      && (back->elf_machine_code == i_ehdrp->e_machine
+		  || (back->elf_machine_alt1 != 0
+		      && back->elf_machine_alt1 == i_ehdrp->e_machine)
+		  || (back->elf_machine_alt2 != 0
+		      && back->elf_machine_alt2 == i_ehdrp->e_machine)))
+	    {
+	      /* target_ptr is an ELF backend which matches this
+		 object file, so reject the ELFOSABI_NONE ELF target.  */
+	      goto got_wrong_format_error;
+	    }
+	}
+    }
+
   if (i_ehdrp->e_shoff != 0)
     {
       bfd_signed_vma where = i_ehdrp->e_shoff;
@@ -848,7 +889,7 @@ elf_object_p (bfd *abfd)
     }
 
   bfd_preserve_finish (abfd, &preserve);
-  return abfd->xvec;
+  return target;
 
  got_wrong_format_error:
   /* There is way too much undoing of half-known state here.  The caller,


Index: binutils.spec
===================================================================
RCS file: /cvs/dist/rpms/binutils/devel/binutils.spec,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- binutils.spec	2 Mar 2007 16:26:43 -0000	1.112
+++ binutils.spec	14 Mar 2007 09:56:11 -0000	1.113
@@ -1,7 +1,7 @@
 Summary: A GNU collection of binary utilities.
 Name: binutils
 Version: 2.17.50.0.12
-Release: 2
+Release: 3
 License: GPL
 Group: Development/Tools
 URL: http://sources.redhat.com/binutils
@@ -13,6 +13,7 @@
 Patch5: binutils-2.17.50.0.12-standards.patch
 Patch6: binutils-2.17.50.0.12-build-fixes.patch
 Patch7: binutils-2.17.50.0.12-symbolic-envvar-revert.patch
+Patch8: binutils-2.17.50.0.12-osabi.patch
 
 Buildroot: %{_tmppath}/binutils-root
 BuildRequires: texinfo >= 4.0, dejagnu, gettext, flex, bison
@@ -61,6 +62,7 @@
 %patch5 -p0 -b .standards~
 %patch6 -p0 -b .build-fixes~
 %patch7 -p0 -b .tekhex~
+%patch8 -p0 -b .osabi~
 
 # On ppc64 we might use 64K pages
 sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c
@@ -68,6 +70,11 @@
 perl -pi -e 's/i\[3-7\]86/i[34567]86/g' */conf*
 sed -i -e 's/%{version}/%{version}-%{release}/g' bfd/configure{.in,}
 sed -i -e '/^libopcodes_la_\(DEPENDENCIES\|LIBADD\)/s,$, ../bfd/libbfd.la,' opcodes/Makefile.{am,in}
+# Build libbfd.so and libopcodes.so with -Bsymbolic-functions if possible.
+if gcc %{optflags} -v --help 2>&1 | grep -q -- -Bsymbolic-functions; then
+sed -i -e '/^libbfd_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' bfd/Makefile.{am,in}
+sed -i -e '/^libopcodes_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' opcodes/Makefile.{am,in}
+fi
 touch */configure
 
 %build
@@ -205,6 +212,12 @@
 %{_infodir}/bfd*info*
 
 %changelog
+* Wed Mar 14 2007 Jakub Jelinek <jakub at redhat.com> 2.17.50.0.12-3
+- don't require matching ELF_OSABI for target vecs with ELFOSABI_NONE,
+  only prefer specific osabi target vecs over the generic ones
+  (H.J.Lu, #230964, BZ#3826)
+- build libbfd.so and libopcodes.so with -Bsymbolic-functions
+
 * Fri Mar  2 2007 Jakub Jelinek <jakub at redhat.com> 2.17.50.0.12-2
 - ignore install-info errors from scriptlets (#223678)
 




More information about the fedora-cvs-commits mailing list