]>
Commit | Line | Data |
---|---|---|
bed94d1d SS |
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 | ||
0f64d6ce MT |
13 | --- a/bfd/elflink.c |
14 | +++ b/bfd/elflink.c | |
15 | @@ -8652,14 +8652,12 @@ bfd_elf_final_link (bfd *abfd, struct bf | |
bed94d1d SS |
16 | goto error_return; |
17 | ||
18 | /* Check for DT_TEXTREL (late, in case the backend removes it). */ | |
0f64d6ce | 19 | - if ((info->warn_shared_textrel && info->shared) |
bed94d1d | 20 | + o = bfd_get_section_by_name (dynobj, ".dynamic"); |
0f64d6ce MT |
21 | + if ((info->warn_shared_textrel && o != NULL) |
22 | || info->error_textrel) | |
bed94d1d SS |
23 | { |
24 | bfd_byte *dyncon, *dynconend; | |
25 | ||
26 | /* Fix up .dynamic entries. */ | |
27 | - o = bfd_get_section_by_name (dynobj, ".dynamic"); | |
28 | - BFD_ASSERT (o != NULL); | |
29 | - | |
30 | dyncon = o->contents; | |
31 | dynconend = o->contents + o->size; | |
32 | for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn) | |
33 | @@ -8702,7 +8702,7 @@ bfd_elf_final_link (bfd *abfd, struct bf | |
0f64d6ce MT |
34 | (_("%P%X: read-only segment has dynamic relocations.\n")); |
35 | else | |
36 | info->callbacks->einfo | |
bed94d1d SS |
37 | - (_("%P: warning: creating a DT_TEXTREL in a shared object.\n")); |
38 | + (_("%P: warning: creating a DT_TEXTREL in object.\n")); | |
39 | break; | |
40 | } | |
41 | } | |
0f64d6ce MT |
42 | --- a/ld/ldmain.c |
43 | +++ b/ld/ldmain.c | |
44 | @@ -282,2 +282,3 @@ main (int argc, char **argv) | |
bed94d1d SS |
45 | link_info.spare_dynamic_tags = 5; |
46 | + link_info.warn_shared_textrel = TRUE; | |
47 | link_info.sharable_sections = FALSE; | |
0f64d6ce MT |
48 | --- a/ld/testsuite/lib/ld-lib.exp |
49 | +++ b/ld/testsuite/lib/ld-lib.exp | |
bed94d1d SS |
50 | @@ -181,6 +181,10 @@ proc default_ld_simple_link { ld target |
51 | # symbol, since the default linker script might use ENTRY. | |
52 | regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output | |
53 | ||
54 | + # Gentoo tweak: | |
55 | + # We want to ignore TEXTREL warnings since we force enable them by default | |
0f64d6ce | 56 | + regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output |
bed94d1d SS |
57 | + |
58 | if [string match "" $exec_output] then { | |
59 | return 1 | |
60 | } else { |