]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blob - binutils/patches/binutils-2.20.1-gentoo-warn-textrel.patch
Change file layout of the makefiles.
[people/arne_f/ipfire-3.x.git] / binutils / patches / binutils-2.20.1-gentoo-warn-textrel.patch
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 --- binutils/bfd/elflink.c
14 +++ binutils/bfd/elflink.c
15 @@ -8652,14 +8652,12 @@
16 goto error_return;
17
18 /* Check for DT_TEXTREL (late, in case the backend removes it). */
19 - if (info->warn_shared_textrel && info->shared)
20 + o = bfd_get_section_by_name (dynobj, ".dynamic");
21 + if (info->warn_shared_textrel && o != NULL)
22 {
23 bfd_byte *dyncon, *dynconend;
24
25 /* Fix up .dynamic entries. */
26 - o = bfd_get_section_by_name (dynobj, ".dynamic");
27 - BFD_ASSERT (o != NULL);
28 -
29 dyncon = o->contents;
30 dynconend = o->contents + o->size;
31 for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
32 @@ -8702,7 +8702,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
33 if (dyn.d_tag == DT_TEXTREL)
34 {
35 info->callbacks->einfo
36 - (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
37 + (_("%P: warning: creating a DT_TEXTREL in object.\n"));
38 break;
39 }
40 }
41 --- binutils/ld/ldmain.c
42 +++ binutils/ld/ldmain.c
43 @@ -282,2 +282,3 @@
44 link_info.spare_dynamic_tags = 5;
45 + link_info.warn_shared_textrel = TRUE;
46 link_info.sharable_sections = FALSE;
47 --- binutils/ld/testsuite/lib/ld-lib.exp
48 +++ binutils/ld/testsuite/lib/ld-lib.exp
49 @@ -181,6 +181,10 @@ proc default_ld_simple_link { ld target
50 # symbol, since the default linker script might use ENTRY.
51 regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
52
53 + # Gentoo tweak:
54 + # We want to ignore TEXTREL warnings since we force enable them by default
55 + regsub -all "^.*ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
56 +
57 if [string match "" $exec_output] then {
58 return 1
59 } else {
60 @@ -899,6 +903,10 @@
61 remote_file build delete "ld.tmp"
62 set cmdret [lindex $cmdret 0]
63
64 + # Gentoo tweak:
65 + # We want to ignore TEXTREL warnings since we force enable them by default
66 + regsub -all "^.*ld-new: warning: creating a DT_TEXTREL in object\." $comp_output "\\1" comp_output
67 +
68 if { $cmdret == 0 && $run_objcopy } {
69 set infile $objfile
70 set objfile "tmpdir/dump1"
71
72 this sucks, but the warn test explicitly checks for textrels, and we
73 change/filter that output with the above hunks
74
75 --- binutils/ld/testsuite/ld-i386/i386.exp
76 +++ binutils/ld/testsuite/ld-i386/i386.exp
77 @@ -176,7 +176,7 @@
78 run_dump_test "pcrel16"
79 run_dump_test "pcrel16abs"
80 run_dump_test "alloc"
81 -run_dump_test "warn1"
82 +#run_dump_test "warn1"
83 run_dump_test "tlsgd2"
84 run_dump_test "tlsie2"
85 run_dump_test "tlsie3"