[PATCH v2] ct-ng: binutils-2.22: add some patches from Debian binutils package

Johannes Stezenbach js@sig21.net
Tue Apr 10 08:00:00 GMT 2012


Hi Yann,

any comments on this patch?

Thanks
Johannes


On Fri, Feb 17, 2012 at 03:36:19PM +0100, Johannes Stezenbach wrote:
> # HG changeset patch
> # User Johannes Stezenbach <js@sig21.net>
> # Date 1329483955 -3600
> # Node ID 81233445a85c1c3e1f2938685a0737103151345d
> # Parent  369e2fbe9010a1911d61b56c977d2c94949daef9
> binutils-2.22: add some patches from Debian binutils package
> 
> Signed-off-by: Johannes Stezenbach <js@sig21.net>
> 
> ---
> The patch for PR 13449 seems to be fairly important for C++
> exception handling.  The sysroot patch for PR ld/10340
> is not in upstream (don't know why), but Debian, Fedora,
> OpenSuse have it and the bugzilla says the issue is hit
> by libtool.
> Note: I only picked up patches relevant for ARM.
> 
> v2:
> - refresh patches so they apply without fuzz
> - rename all *.diff to *.patch so they are actually applied
> - add patch for PR ld/13468
> 
> 
> diff -r 369e2fbe9010 -r 81233445a85c patches/binutils/2.22/300-128_build_id.patch
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/patches/binutils/2.22/300-128_build_id.patch	Fri Feb 17 14:05:55 2012 +0100
> @@ -0,0 +1,45 @@
> +Description: Description: Fix ld corrupt build ID generation
> +Author: Nick Clifton
> +Upstream status: Taken from Fedora (BZ 501582)
> +
> +http://sourceware.org/bugzilla/show_bug.cgi?id=12451
> +
> +
> +--- binutils-2.22.orig/bfd/compress.c	2011-04-11 06:08:12.000000000 +0200
> ++++ binutils-2.22/bfd/compress.c	2012-02-17 14:00:11.000000000 +0100
> +@@ -181,7 +181,7 @@ bfd_get_full_section_contents (bfd *abfd
> +     case COMPRESS_SECTION_NONE:
> +       if (p == NULL)
> + 	{
> +-	  p = (bfd_byte *) bfd_malloc (sz);
> ++	  p = (bfd_byte *) bfd_zmalloc (sz);
> + 	  if (p == NULL)
> + 	    return FALSE;
> + 	}
> +--- binutils-2.22.orig/bfd/elfcode.h	2011-06-06 03:26:01.000000000 +0200
> ++++ binutils-2.22/bfd/elfcode.h	2012-02-17 14:00:11.000000000 +0100
> +@@ -1099,6 +1099,24 @@ elf_checksum_contents (bfd *abfd,
> + 
> +       if (i_shdr.contents)
> + 	(*process) (i_shdr.contents, i_shdr.sh_size, arg);
> ++      else
> ++	{
> ++	  asection *sec;
> ++
> ++	  sec = bfd_section_from_elf_index (abfd, count);
> ++	  if (sec != NULL)
> ++	    {
> ++	      if (sec->contents == NULL)
> ++		{
> ++		  /* Force rereading from file.  */
> ++		  sec->flags &= ~SEC_IN_MEMORY;
> ++		  if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
> ++		    continue;
> ++		}
> ++	      if (sec->contents != NULL)
> ++		(*process) (sec->contents, i_shdr.sh_size, arg);
> ++	    }
> ++	}
> +     }
> + 
> +   return TRUE;
> diff -r 369e2fbe9010 -r 81233445a85c patches/binutils/2.22/300-140_pr10340.patch
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/patches/binutils/2.22/300-140_pr10340.patch	Fri Feb 17 14:05:55 2012 +0100
> @@ -0,0 +1,36 @@
> +# DP: Proposed patch for PR ld/10340, ld doesn't honor sysroot prefix for ldscripts
> +
> +Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
> +
> +Always try to prepend the sysroot prefix to absolute filenames first.
> +
> +
> +--- binutils-2.22.orig/ld/ldfile.c	2011-04-20 02:22:08.000000000 +0200
> ++++ binutils-2.22/ld/ldfile.c	2012-02-17 14:00:13.000000000 +0100
> +@@ -351,18 +351,24 @@ ldfile_open_file_search (const char *arc
> +      directory first.  */
> +   if (! entry->maybe_archive)
> +     {
> +-      if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
> ++      /* For absolute pathnames, try to always open the file in the
> ++	 sysroot first. If this fails, try to open the file at the
> ++	 given location. */
> ++      entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
> ++      if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
> + 	{
> + 	  char *name = concat (ld_sysroot, entry->filename,
> + 			       (const char *) NULL);
> + 	  if (ldfile_try_open_bfd (name, entry))
> + 	    {
> + 	      entry->filename = name;
> ++	      entry->sysrooted = TRUE;
> + 	      return TRUE;
> + 	    }
> + 	  free (name);
> + 	}
> +-      else if (ldfile_try_open_bfd (entry->filename, entry))
> ++
> ++      if (ldfile_try_open_bfd (entry->filename, entry))
> + 	{
> + 	  entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
> + 	    && is_sysrooted_pathname (entry->filename, TRUE);
> diff -r 369e2fbe9010 -r 81233445a85c patches/binutils/2.22/300-160_gas_pr12698.patch
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/patches/binutils/2.22/300-160_gas_pr12698.patch	Fri Feb 17 14:05:55 2012 +0100
> @@ -0,0 +1,54 @@
> +# DP: Proposed patch for PR gas/12698
> +
> +2011-04-15  Bernd Schmidt  <bernds@codesourcery.com>
> +
> +	gas/
> +	* config/tc-arm.c (m_profile_p): New function.
> +	(parse_psr, do_t_mrs, do_t_msr): Use m_profile_p.
> +
> +
> +--- binutils-2.22.orig/gas/config/tc-arm.c	2011-11-21 10:29:31.000000000 +0100
> ++++ binutils-2.22/gas/config/tc-arm.c	2012-02-17 14:00:15.000000000 +0100
> +@@ -234,6 +234,15 @@ static const arm_feature_set fpu_vfp_fp1
> + static const arm_feature_set fpu_neon_ext_fma = ARM_FEATURE (0, FPU_NEON_EXT_FMA);
> + static const arm_feature_set fpu_vfp_ext_fma = ARM_FEATURE (0, FPU_VFP_EXT_FMA);
> + 
> ++/* Return whether FEATURES indicates an M profile CPU, without getting
> ++   confused by ARM_ANY.  */
> ++static int
> ++m_profile_p (arm_feature_set features)
> ++{
> ++  return (ARM_CPU_HAS_FEATURE (features, arm_ext_v6m)
> ++	  && !ARM_CPU_HAS_FEATURE (features, arm_ext_v7a));
> ++}
> ++
> + static int mfloat_abi_opt = -1;
> + /* Record user cpu selection for object attributes.  */
> + static arm_feature_set selected_cpu = ARM_ARCH_NONE;
> +@@ -5428,7 +5437,7 @@ parse_psr (char **str, bfd_boolean lhs)
> +   const struct asm_psr *psr;
> +   char *start;
> +   bfd_boolean is_apsr = FALSE;
> +-  bfd_boolean m_profile = ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_m);
> ++  bfd_boolean m_profile = m_profile_p (selected_cpu);
> + 
> +   /* PR gas/12698:  If the user has specified -march=all then m_profile will
> +      be TRUE, but we want to ignore it in this case as we are building for any
> +@@ -11101,7 +11110,7 @@ do_t_mrs (void)
> +     {
> +       int flags = inst.operands[1].imm & (PSR_c|PSR_x|PSR_s|PSR_f|SPSR_BIT);
> + 
> +-      if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_m))
> ++      if (m_profile_p (selected_cpu))
> + 	constraint (flags != 0, _("selected processor does not support "
> +         	    "requested special purpose register"));
> +       else
> +@@ -11133,7 +11142,7 @@ do_t_msr (void)
> +   else
> +     flags = inst.operands[0].imm;
> + 
> +-  if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_m))
> ++  if (m_profile_p (selected_cpu))
> +     {
> +       int bits = inst.operands[0].imm & (PSR_c|PSR_x|PSR_s|PSR_f|SPSR_BIT);
> + 
> diff -r 369e2fbe9010 -r 81233445a85c patches/binutils/2.22/300-pr13449.patch
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/patches/binutils/2.22/300-pr13449.patch	Fri Feb 17 14:05:55 2012 +0100
> @@ -0,0 +1,18 @@
> +2011-12-21  Nick Clifton  <nickc@redhat.com>
> +
> +	PR gas/13449
> +	* config/tc-arm.c (create_unwind_entry): Zero allocated table
> +	entries.
> +
> + 
> +--- binutils-2.22.orig/gas/config/tc-arm.c	2012-02-17 14:00:15.000000000 +0100
> ++++ binutils-2.22/gas/config/tc-arm.c	2012-02-17 14:00:17.000000000 +0100
> +@@ -19901,6 +19901,8 @@ create_unwind_entry (int have_data)
> + 
> +   /* Allocate the table entry.	*/
> +   ptr = frag_more ((size << 2) + 4);
> ++  /* PR 13449: Zero the table entries in case some of them are not used.  */
> ++  memset (ptr, 0, (size << 2) + 4);
> +   where = frag_now_fix () - ((size << 2) + 4);
> + 
> +   switch (unwind.personality_index)
> diff -r 369e2fbe9010 -r 81233445a85c patches/binutils/2.22/300-pr13468.patch
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/patches/binutils/2.22/300-pr13468.patch	Fri Feb 17 14:05:55 2012 +0100
> @@ -0,0 +1,28 @@
> +2011-12-03  Alan Modra  <amodra@gmail.com>
> +
> +	PR ld/13468
> +	* elflink.c (bfd_elf_final_link): Don't segfault when checking
> +	for DT_TEXTREL and .dynamic does not exist.
> +
> +
> +--- binutils-2.22.orig/bfd/elflink.c	2011-11-21 10:29:26.000000000 +0100
> ++++ binutils-2.22/bfd/elflink.c	2012-02-17 14:00:21.000000000 +0100
> +@@ -11188,15 +11188,12 @@ bfd_elf_final_link (bfd *abfd, struct bf
> + 	goto error_return;
> + 
> +       /* Check for DT_TEXTREL (late, in case the backend removes it).  */
> +-      if ((info->warn_shared_textrel && info->shared)
> +-	  || info->error_textrel)
> ++      if (((info->warn_shared_textrel && info->shared)
> ++	   || info->error_textrel)
> ++	  && (o = bfd_get_section_by_name (dynobj, ".dynamic")) != NULL)
> + 	{
> + 	  bfd_byte *dyncon, *dynconend;
> + 
> +-	  /* Fix up .dynamic entries.  */
> +-	  o = bfd_get_section_by_name (dynobj, ".dynamic");
> +-	  BFD_ASSERT (o != NULL);
> +-
> + 	  dyncon = o->contents;
> + 	  dynconend = o->contents + o->size;
> + 	  for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
> 
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
> 
> 

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list