scripts/addToolsVersion: properly handle .in vs. .in.2
While most components have their version in the .in file, some
have it in the .in.2 (eg. elf2flt).
Currently, to handle this case, we indiscriminately munge both files,
but this is wrong: in the elf2flt case, if we add a binutils version,
we do not want it to be added to elf2flt, and conversely.
So, for each tool, we need to explicitly know what file to munge.
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.
6 2006-06-10 Ned Ludd <solar@gentoo.org>, Mike Frysinger <vapier@gentoo.org>
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.
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 @@
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)
24 bfd_byte *dyncon, *dynconend;
26 /* Fix up .dynamic entries. */
27 - o = bfd_get_section_by_name (dynobj, ".dynamic");
28 - BFD_ASSERT (o != NULL);
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)
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"));
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
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);
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
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
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
64 if [string match "" $exec_output] then {