When deciding if ".text" section should be read-only, don't forget to reset
authorNick Clifton <nickc@redhat.com>
Tue, 23 May 2000 21:03:35 +0000 (21:03 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 23 May 2000 21:03:35 +0000 (21:03 +0000)
SEC_READONLY because it could be already set.

ld/ChangeLog
ld/ldmain.c

index 801de43428baa3ee91f27f972cfb768f1148b401..f0f2b6b851bacc911b167dbc2e2685480b81beba 100644 (file)
@@ -1,3 +1,9 @@
+2000-05-22  Igor Shevlyakov  <igor@windriver.com>
+
+       * ldmain.c (main): When deciding if ".text" section should be
+        read-only, don't forget to reset SEC_READONLY because it
+        could be already set.
+
 2000-05-22  Thomas de Lellis  <tdel@windriver.com>
 
         * ld.1: Add documentation for new command line option:
index cfdbdd7a808f177eb1aa5bb628e5fb37f0c0f07b..73725949d2f2a314e425f12feecaa12ac71f3ec8 100644 (file)
@@ -347,17 +347,18 @@ main (argc, argv)
   /* Print error messages for any missing symbols, for any warning
      symbols, and possibly multiple definitions */
 
-
-  if (config.text_read_only)
-    {
-      /* Look for a text section and mark the readonly attribute in it */
-      asection *found = bfd_get_section_by_name (output_bfd, ".text");
-
-      if (found != (asection *) NULL)
-       {
+  /* Look for a text section and switch the readonly attribute in it.  */
+  {
+    asection * found = bfd_get_section_by_name (output_bfd, ".text");
+    
+    if (found != (asection *) NULL)
+      {
+       if (config.text_read_only)
          found->flags |= SEC_READONLY;
-       }
-    }
+       else
+         found->flags &= ~SEC_READONLY;
+      }
+  }
 
   if (link_info.relocateable)
     output_bfd->flags &= ~EXEC_P;