1.1 --- a/patches/binutils/2.20.1/170-warn-textrel.patch Sun Sep 11 18:26:12 2011 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,66 +0,0 @@
1.4 -textrels are bad for forcing copy-on-write (this affects everyone),
1.5 -and for security/runtime code generation, this affects security ppl.
1.6 -But in either case, it doesn't matter who needs textrels, it's
1.7 -the very fact that they're needed at all.
1.8 -
1.9 -2006-06-10 Ned Ludd <solar@gentoo.org>, Mike Frysinger <vapier@gentoo.org>
1.10 -
1.11 - * bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs.
1.12 - * ld/ldmain.c (main): Change textrel warning default to true.
1.13 - * ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL
1.14 - warnings from ld output.
1.15 -
1.16 -diff -durN binutils-2.20.1.orig/bfd/elflink.c binutils-2.20.1/bfd/elflink.c
1.17 ---- binutils-2.20.1.orig/bfd/elflink.c 2010-08-17 19:32:11.000000000 +0200
1.18 -+++ binutils-2.20.1/bfd/elflink.c 2010-08-17 19:32:13.000000000 +0200
1.19 -@@ -10988,14 +10988,12 @@
1.20 - goto error_return;
1.21 -
1.22 - /* Check for DT_TEXTREL (late, in case the backend removes it). */
1.23 -- if (info->warn_shared_textrel && info->shared)
1.24 -+ o = bfd_get_section_by_name (dynobj, ".dynamic");
1.25 -+ if (info->warn_shared_textrel && o != NULL)
1.26 - {
1.27 - bfd_byte *dyncon, *dynconend;
1.28 -
1.29 - /* Fix up .dynamic entries. */
1.30 -- o = bfd_get_section_by_name (dynobj, ".dynamic");
1.31 -- BFD_ASSERT (o != NULL);
1.32 --
1.33 - dyncon = o->contents;
1.34 - dynconend = o->contents + o->size;
1.35 - for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
1.36 -@@ -11007,7 +11005,7 @@
1.37 - if (dyn.d_tag == DT_TEXTREL)
1.38 - {
1.39 - info->callbacks->einfo
1.40 -- (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
1.41 -+ (_("%P: warning: creating a DT_TEXTREL in object.\n"));
1.42 - break;
1.43 - }
1.44 - }
1.45 -diff -durN binutils-2.20.1.orig/ld/ldmain.c binutils-2.20.1/ld/ldmain.c
1.46 ---- binutils-2.20.1.orig/ld/ldmain.c 2009-09-14 13:43:29.000000000 +0200
1.47 -+++ binutils-2.20.1/ld/ldmain.c 2010-08-17 19:32:13.000000000 +0200
1.48 -@@ -280,6 +280,7 @@
1.49 - emulation = get_emulation (argc, argv);
1.50 - ldemul_choose_mode (emulation);
1.51 - default_target = ldemul_choose_target (argc, argv);
1.52 -+ link_info.warn_shared_textrel = TRUE;
1.53 - config.maxpagesize = bfd_emul_get_maxpagesize (default_target);
1.54 - config.commonpagesize = bfd_emul_get_commonpagesize (default_target);
1.55 - lang_init ();
1.56 -diff -durN binutils-2.20.1.orig/ld/testsuite/lib/ld-lib.exp binutils-2.20.1/ld/testsuite/lib/ld-lib.exp
1.57 ---- binutils-2.20.1.orig/ld/testsuite/lib/ld-lib.exp 2009-10-02 12:51:13.000000000 +0200
1.58 -+++ binutils-2.20.1/ld/testsuite/lib/ld-lib.exp 2010-08-17 19:32:13.000000000 +0200
1.59 -@@ -196,6 +196,10 @@
1.60 - # symbol, since the default linker script might use ENTRY.
1.61 - regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
1.62 -
1.63 -+ # Gentoo tweak:
1.64 -+ # We want to ignore TEXTREL warnings since we force enable them by default
1.65 -+ regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
1.66 -+
1.67 - if [string match "" $exec_output] then {
1.68 - return 1
1.69 - } else {