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