]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR ld/13254
authorAlan Modra <amodra@gmail.com>
Tue, 25 Oct 2011 03:12:18 +0000 (03:12 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 25 Oct 2011 03:12:18 +0000 (03:12 +0000)
include/
2011-10-19  Alan Modra  <amodra@gmail.com>
* bfdlink.h (struct bfd_link_info): Add error_textrel.
bfd/
2011-10-19  Alan Modra  <amodra@gmail.com>
* elflink.c (bfd_elf_final_link): Emit error_textrel error.
ld/
2011-10-19  Alan Modra  <amodra@gmail.com>
* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
-z text, -z notext, -z textoff options for all targets having
shared lib support.

bfd/ChangeLog
bfd/elflink.c
include/ChangeLog
include/bfdlink.h
ld/ChangeLog
ld/emultempl/elf32.em

index 20793ed93d55616238540f3029fcfb3fc5b8039f..9513fb737f9526ff8816a10df05c5643625566c2 100644 (file)
@@ -1,6 +1,10 @@
 2011-10-25  Alan Modra  <amodra@gmail.com>
 
        Apply mainline patches
+       2011-10-19  Alan Modra  <amodra@gmail.com>
+       PR ld/13254
+       * elflink.c (bfd_elf_final_link): Emit error_textrel error.
+
        2011-10-17  Alan Modra  <amodra@gmail.com>
        PR ld/12975
        PR ld/13195
index f8741e41538664c2039eb27c6028e0c11577c478..be0a6ce1cbe3d97c4dcd054c6186c25c8797c295 100644 (file)
@@ -11187,7 +11187,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
        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->shared)
+         || info->error_textrel)
        {
          bfd_byte *dyncon, *dynconend;
 
@@ -11205,8 +11206,12 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
 
              if (dyn.d_tag == DT_TEXTREL)
                {
-                info->callbacks->einfo
-                   (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
+                 if (info->error_textrel)
+                   info->callbacks->einfo
+                     (_("%P%X: read-only segment has dynamic relocations.\n"));
+                 else
+                   info->callbacks->einfo
+                     (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
                  break;
                }
            }
index d1349d62036a15fca8bcf68a4d5d404195b2768d..af969774f6d1982a08db65cf87d43b169b30b2e9 100644 (file)
@@ -1,6 +1,10 @@
 2011-10-25  Alan Modra  <amodra@gmail.com>
 
        Apply mainline patches.
+       2011-10-19  Alan Modra  <amodra@gmail.com>
+       PR ld/13254
+       * bfdlink.h (struct bfd_link_info): Add error_textrel.
+
        2011-09-26  Cary Coutant  <ccoutant@google.com>
        gcc PR lto/47247
        * plugin-api.h (enum ld_plugin_symbol_resolution): Add
index c9e127c5c9995230968ca5c625c005fb08c42720..be853295ada0d3eba4c26a693dfada30b243c5c5 100644 (file)
@@ -337,6 +337,9 @@ struct bfd_link_info
   /* TRUE if we should warn when adding a DT_TEXTREL to a shared object.  */
   unsigned int warn_shared_textrel: 1;
 
+  /* TRUE if we should error when adding a DT_TEXTREL.  */
+  unsigned int error_textrel: 1;
+
   /* TRUE if .hash section should be created.  */
   unsigned int emit_hash: 1;
 
index 8a49cf6dd9d0ddd7089d52c5355cad574776f997..3c1802d9dc1d5cf221f5011609b377a56b15e068 100644 (file)
@@ -1,6 +1,12 @@
 2011-10-25  Alan Modra  <amodra@gmail.com>
 
        Apply mainline patches
+       2011-10-19  Alan Modra  <amodra@gmail.com>
+       PR ld/13254
+       * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
+       -z text, -z notext, -z textoff options for all targets having
+       shared lib support.
+
        2011-10-15  Alan Modra  <amodra@gmail.com>
        * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Remove toc check.
 
index 7c8e55bb9aaec5ccbd324840472f6199dbba0bde..78a708bb4f02a45ba2b887c536d05794bd1546ad 100644 (file)
@@ -2327,6 +2327,12 @@ fragment <<EOF
        link_info.relro = TRUE;
       else if (strcmp (optarg, "norelro") == 0)
        link_info.relro = FALSE;
+      else if (strcmp (optarg, "text") == 0)
+       link_info.error_textrel = TRUE;
+      else if (strcmp (optarg, "notext") == 0)
+       link_info.error_textrel = FALSE;
+      else if (strcmp (optarg, "textoff") == 0)
+       link_info.error_textrel = FALSE;
 EOF
 fi