patches/binutils/2.20.1a/170-warn-textrel.patch
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Tue Jul 31 22:27:29 2012 +0200 (2012-07-31)
changeset 3018 7776e8369284
parent 2088 4f21ba5f8e91
permissions -rw-r--r--
complibs/cloog: create missing m4 dir

Because we now patch configure.in and configure, the Makefile quicks
in a re-build rule as the source files are now more recent than the
bundled generated files, and that fails because the m4 directory
is missing, although on some systems where aclocal is not installed,
the re-build rule does nothing (except a warning).

Always create tht directory.

Reported-by: Per Arnold Blaasmo <per-arnold.blaasmo@atmel.com>
[Also thanks to Thomas De Schampheleire <patrickdepinguin@gmail.com>
for some digging works on this issue]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
     1 textrels are bad for forcing copy-on-write (this affects everyone),
     2 and for security/runtime code generation, this affects security ppl.
     3 But in either case, it doesn't matter who needs textrels, it's
     4 the very fact that they're needed at all.
     5 
     6 2006-06-10  Ned Ludd  <solar@gentoo.org>, Mike Frysinger <vapier@gentoo.org>
     7 
     8 	* bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs.
     9 	* ld/ldmain.c (main): Change textrel warning default to true.
    10 	* ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL
    11 	warnings from ld output.
    12 
    13 diff -durN binutils-2.20.1.orig/bfd/elflink.c binutils-2.20.1/bfd/elflink.c
    14 --- binutils-2.20.1.orig/bfd/elflink.c	2010-08-17 19:32:11.000000000 +0200
    15 +++ binutils-2.20.1/bfd/elflink.c	2010-08-17 19:32:13.000000000 +0200
    16 @@ -10988,14 +10988,12 @@
    17  	goto error_return;
    18  
    19        /* Check for DT_TEXTREL (late, in case the backend removes it).  */
    20 -      if (info->warn_shared_textrel && info->shared)
    21 +      o = bfd_get_section_by_name (dynobj, ".dynamic");
    22 +      if (info->warn_shared_textrel && o != NULL)
    23  	{
    24  	  bfd_byte *dyncon, *dynconend;
    25  
    26  	  /* Fix up .dynamic entries.  */
    27 -	  o = bfd_get_section_by_name (dynobj, ".dynamic");
    28 -	  BFD_ASSERT (o != NULL);
    29 -
    30  	  dyncon = o->contents;
    31  	  dynconend = o->contents + o->size;
    32  	  for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
    33 @@ -11007,7 +11005,7 @@
    34  	      if (dyn.d_tag == DT_TEXTREL)
    35  		{
    36  		 info->callbacks->einfo
    37 -		    (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
    38 +		    (_("%P: warning: creating a DT_TEXTREL in object.\n"));
    39  		  break;
    40  		}
    41  	    }
    42 diff -durN binutils-2.20.1.orig/ld/ldmain.c binutils-2.20.1/ld/ldmain.c
    43 --- binutils-2.20.1.orig/ld/ldmain.c	2009-09-14 13:43:29.000000000 +0200
    44 +++ binutils-2.20.1/ld/ldmain.c	2010-08-17 19:32:13.000000000 +0200
    45 @@ -280,6 +280,7 @@
    46    emulation = get_emulation (argc, argv);
    47    ldemul_choose_mode (emulation);
    48    default_target = ldemul_choose_target (argc, argv);
    49 +  link_info.warn_shared_textrel = TRUE;
    50    config.maxpagesize = bfd_emul_get_maxpagesize (default_target);
    51    config.commonpagesize = bfd_emul_get_commonpagesize (default_target);
    52    lang_init ();
    53 diff -durN binutils-2.20.1.orig/ld/testsuite/lib/ld-lib.exp binutils-2.20.1/ld/testsuite/lib/ld-lib.exp
    54 --- binutils-2.20.1.orig/ld/testsuite/lib/ld-lib.exp	2009-10-02 12:51:13.000000000 +0200
    55 +++ binutils-2.20.1/ld/testsuite/lib/ld-lib.exp	2010-08-17 19:32:13.000000000 +0200
    56 @@ -196,6 +196,10 @@
    57      # symbol, since the default linker script might use ENTRY.
    58      regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
    59  
    60 +    # Gentoo tweak:
    61 +    # We want to ignore TEXTREL warnings since we force enable them by default
    62 +    regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
    63 +
    64      if [string match "" $exec_output] then {
    65  	return 1
    66      } else {