patches/binutils/2.20.1/170-warn-textrel.patch
author "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
Thu Aug 18 16:05:48 2011 +0200 (2011-08-18)
changeset 2612 a52574521bea
parent 1621 60446d2e5660
permissions -rw-r--r--
debug/gdb: update GDB revisions

Update GDB with the latest available revisions.

Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
     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 {