patches/binutils/2.19.1a/150-warn-textrel.patch
changeset 2664 346263a07115
parent 1243 5d15872659ec
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/binutils/2.19.1a/150-warn-textrel.patch	Sun Sep 11 18:18:53 2011 +0200
     1.3 @@ -0,0 +1,53 @@
     1.4 +Original patch from: ../crosstool-NG/ct-ng.trunk/patches/binutils/2.19/150-warn-textrel.patch
     1.5 +
     1.6 +-= BEGIN original header =-
     1.7 +Original patch from Gentoo:
     1.8 +gentoo/src/patchsets/binutils/2.19/66_all_binutils-2.18.50.0.2-warn-textrel.patch
     1.9 +
    1.10 +textrels are bad for forcing copy-on-write (this affects everyone),
    1.11 +and for security/runtime code generation, this affects security ppl.
    1.12 +But in either case, it doesn't matter who needs textrels, it's
    1.13 +the very fact that they're needed at all.
    1.14 +
    1.15 +-= END original header =-
    1.16 +
    1.17 +diff -durN binutils-2.19.1.orig/bfd/elflink.c binutils-2.19.1/bfd/elflink.c
    1.18 +--- binutils-2.19.1.orig/bfd/elflink.c	2009-03-08 11:57:02.000000000 +0100
    1.19 ++++ binutils-2.19.1/bfd/elflink.c	2009-03-08 11:57:02.000000000 +0100
    1.20 +@@ -10820,14 +10820,12 @@
    1.21 + 	goto error_return;
    1.22 + 
    1.23 +       /* Check for DT_TEXTREL (late, in case the backend removes it).  */
    1.24 +-      if (info->warn_shared_textrel && info->shared)
    1.25 ++      o = bfd_get_section_by_name (dynobj, ".dynamic");
    1.26 ++      if (info->warn_shared_textrel && o != NULL)
    1.27 + 	{
    1.28 + 	  bfd_byte *dyncon, *dynconend;
    1.29 + 
    1.30 + 	  /* Fix up .dynamic entries.  */
    1.31 +-	  o = bfd_get_section_by_name (dynobj, ".dynamic");
    1.32 +-	  BFD_ASSERT (o != NULL);
    1.33 +-
    1.34 + 	  dyncon = o->contents;
    1.35 + 	  dynconend = o->contents + o->size;
    1.36 + 	  for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
    1.37 +@@ -10839,7 +10837,7 @@
    1.38 + 	      if (dyn.d_tag == DT_TEXTREL)
    1.39 + 		{
    1.40 + 		 info->callbacks->einfo
    1.41 +-		    (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
    1.42 ++		    (_("%P: warning: creating a DT_TEXTREL in object.\n"));
    1.43 + 		  break;
    1.44 + 		}
    1.45 + 	    }
    1.46 +diff -durN binutils-2.19.1.orig/ld/ldmain.c binutils-2.19.1/ld/ldmain.c
    1.47 +--- binutils-2.19.1.orig/ld/ldmain.c	2008-08-17 05:12:50.000000000 +0200
    1.48 ++++ binutils-2.19.1/ld/ldmain.c	2009-03-08 11:57:02.000000000 +0100
    1.49 +@@ -274,6 +274,7 @@
    1.50 +   link_info.relax_pass = 1;
    1.51 +   link_info.pei386_auto_import = -1;
    1.52 +   link_info.spare_dynamic_tags = 5;
    1.53 ++  link_info.warn_shared_textrel = TRUE;
    1.54 +   link_info.path_separator = ':';
    1.55 + 
    1.56 +   ldfile_add_arch ("");