textrels are bad for forcing copy-on-write (this affects everyone), and for security/runtime code generation, this affects security ppl. But in either case, it doesn't matter who needs textrels, it's the very fact that they're needed at all. 2006-06-10 Ned Ludd , Mike Frysinger * bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs. * ld/ldmain.c (main): Change textrel warning default to true. * ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL warnings from ld output. --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -8652,7 +8652,7 @@ bfd_elf_final_link (bfd *abfd, struct bf goto error_return; /* Check for DT_TEXTREL (late, in case the backend removes it). */ - if (((info->warn_shared_textrel && info->shared) + if ((info->warn_shared_textrel || info->error_textrel) && (o = bfd_get_section_by_name (dynobj, ".dynamic")) != NULL) { @@ -8702,7 +8702,7 @@ bfd_elf_final_link (bfd *abfd, struct bf (_("%P%X: read-only segment has dynamic relocations.\n")); else info->callbacks->einfo - (_("%P: warning: creating a DT_TEXTREL in a shared object.\n")); + (_("%P: warning: creating a DT_TEXTREL in object.\n")); break; } } --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -282,2 +282,3 @@ main (int argc, char **argv) link_info.spare_dynamic_tags = 5; + link_info.warn_shared_textrel = TRUE; link_info.sharable_sections = FALSE; --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -181,6 +181,10 @@ proc default_ld_simple_link { ld target # symbol, since the default linker script might use ENTRY. regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output + # Gentoo tweak: + # We want to ignore TEXTREL warnings since we force enable them by default + regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output + if [string match "" $exec_output] then { return 1 } else {