* emultempl/mipsecoff.em (gld{EMULATION_NAME}_after_open): Require all
[binutils-gdb.git] / ld / ldmain.c
index cfdbdd7a808f177eb1aa5bb628e5fb37f0c0f07b..48f35efdfab4360aaaafeb869bb38459d4ea6416 100644 (file)
@@ -1,5 +1,5 @@
 /* Main program of GNU linker.
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Steve Chamberlain steve@cygnus.com
 
@@ -27,6 +27,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "libiberty.h"
 #include "progress.h"
 #include "bfdlink.h"
+#include "filenames.h"
 
 #include "ld.h"
 #include "ldmain.h"
@@ -347,17 +348,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;
@@ -568,6 +570,14 @@ set_scripts_dir ()
 
   /* Look for "ldscripts" in the dir where our binary is.  */
   end = strrchr (program_name, '/');
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+  {
+    /* We could have \foo\bar, or /foo\bar.  */
+    char *bslash = strrchr (program_name, '\\');
+    if (bslash > end)
+      end = bslash;
+  }
+#endif
 
   if (end == NULL)
     {