* som.c (struct fixup_format): Constify `format'.
[deliverable/binutils-gdb.git] / ld / ldmain.c
index 48f35efdfab4360aaaafeb869bb38459d4ea6416..22d77a4b7cc37c12041a6227ad681465fa9fef63 100644 (file)
@@ -36,9 +36,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "ldgram.h"
 #include "ldexp.h"
 #include "ldlang.h"
-#include "ldemul.h"
 #include "ldlex.h"
 #include "ldfile.h"
+#include "ldemul.h"
 #include "ldctor.h"
 
 /* Somewhere above, sys/stat.h got included . . . . */
@@ -237,6 +237,9 @@ main (argc, argv)
      and _fini symbols.  We are compatible.  */
   link_info.init_function = "_init";
   link_info.fini_function = "_fini";
+  link_info.new_dtags = false;
+  link_info.flags = (bfd_vma) 0;
+  link_info.flags_1 = (bfd_vma) 0;
 
   ldfile_add_arch ("");
 
@@ -348,18 +351,19 @@ main (argc, argv)
   /* Print error messages for any missing symbols, for any warning
      symbols, and possibly multiple definitions */
 
-  /* Look for a text section and switch the readonly attribute in it.  */
-  {
-    asection * found = bfd_get_section_by_name (output_bfd, ".text");
+  if (! link_info.relocateable)
+    {
+      /* 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 (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;
@@ -574,7 +578,7 @@ set_scripts_dir ()
   {
     /* We could have \foo\bar, or /foo\bar.  */
     char *bslash = strrchr (program_name, '\\');
-    if (bslash > end)
+    if (end == NULL || (bslash != NULL && bslash > end))
       end = bslash;
   }
 #endif
This page took 0.024077 seconds and 4 git commands to generate.