Convert #ifdef HAVE_NONSTEPPABLE_WATCHPOINT into C
[deliverable/binutils-gdb.git] / ld / ldfile.c
index 1456e3d10a2e3ea4bf87dc2e20ddaf42b043665d..9fb2b2dab9e4ef24a29637693d362e776eedab9b 100644 (file)
@@ -1,5 +1,5 @@
 /* Linker file opening and searching.
 /* Linker file opening and searching.
-   Copyright (C) 1991, 92, 93, 94, 95, 98, 99, 2000
+   Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
    Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
@@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "bfd.h"
 #include "sysdep.h"
 #include "bfdlink.h"
 #include "bfd.h"
 #include "sysdep.h"
 #include "bfdlink.h"
+#include "safe-ctype.h"
 #include "ld.h"
 #include "ldmisc.h"
 #include "ldexp.h"
 #include "ld.h"
 #include "ldmisc.h"
 #include "ldexp.h"
@@ -33,8 +34,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "ldgram.h"
 #include "ldlex.h"
 #include "ldemul.h"
 #include "ldgram.h"
 #include "ldlex.h"
 #include "ldemul.h"
-
-#include <ctype.h>
+#include "libiberty.h"
 
 const char *ldfile_input_filename;
 boolean ldfile_assumed_script = false;
 
 const char *ldfile_input_filename;
 boolean ldfile_assumed_script = false;
@@ -79,6 +79,9 @@ ldfile_add_library_path (name, cmdline)
 {
   search_dirs_type *new;
 
 {
   search_dirs_type *new;
 
+  if (!cmdline && config.only_cmd_line_lib_dirs)
+    return;
+
   new = (search_dirs_type *) xmalloc (sizeof (search_dirs_type));
   new->next = NULL;
   new->name = name;
   new = (search_dirs_type *) xmalloc (sizeof (search_dirs_type));
   new->next = NULL;
   new->name = name;
@@ -129,7 +132,12 @@ ldfile_try_open_bfd (attempt, entry)
        {
          if (! bfd_check_format (check, bfd_object))
            return true;
        {
          if (! bfd_check_format (check, bfd_object))
            return true;
-         if (bfd_arch_get_compatible (check, output_bfd) == NULL)
+
+         if ((bfd_arch_get_compatible (check, output_bfd) == NULL)
+             /* XCOFF archives can have 32 and 64 bit objects */
+             && ! (bfd_get_flavour (check) == bfd_target_xcoff_flavour
+                   && bfd_get_flavour (output_bfd) == bfd_target_xcoff_flavour
+                   && bfd_check_format (entry->the_bfd, bfd_archive)))
            {
              einfo (_("%P: skipping incompatible %s when searching for %s\n"),
                     attempt, entry->local_sym_name);
            {
              einfo (_("%P: skipping incompatible %s when searching for %s\n"),
                     attempt, entry->local_sym_name);
@@ -189,7 +197,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
       else if (entry->filename[0] == '/' || entry->filename[0] == '.'
 #if defined (__MSDOS__) || defined (_WIN32)
               || entry->filename[0] == '\\'
       else if (entry->filename[0] == '/' || entry->filename[0] == '.'
 #if defined (__MSDOS__) || defined (_WIN32)
               || entry->filename[0] == '\\'
-              || (isalpha (entry->filename[0])
+              || (ISALPHA (entry->filename[0])
                   && entry->filename[1] == ':')
 #endif
          )
                   && entry->filename[1] == ':')
 #endif
          )
@@ -349,7 +357,8 @@ ldfile_open_command_file (name)
 
   ldfile_input_filename = name;
   lineno = 1;
 
   ldfile_input_filename = name;
   lineno = 1;
-  had_script = true;
+
+  saved_script_handle = ldlex_input_stack;
 }
 
 #ifdef GNU960
 }
 
 #ifdef GNU960
@@ -412,9 +421,9 @@ ldfile_add_arch (name)
 
 void
 ldfile_add_arch (in_name)
 
 void
 ldfile_add_arch (in_name)
-     CONST char *in_name;
+     const char *in_name;
 {
 {
-  char *name = buystring (in_name);
+  char *name = xstrdup (in_name);
   search_arch_type *new =
     (search_arch_type *) xmalloc (sizeof (search_arch_type));
 
   search_arch_type *new =
     (search_arch_type *) xmalloc (sizeof (search_arch_type));
 
@@ -424,8 +433,7 @@ ldfile_add_arch (in_name)
   new->next = (search_arch_type *) NULL;
   while (*name)
     {
   new->next = (search_arch_type *) NULL;
   while (*name)
     {
-      if (isupper ((unsigned char) *name))
-       *name = tolower ((unsigned char) *name);
+      *name = TOLOWER (*name);
       name++;
     }
   *search_arch_tail_ptr = new;
       name++;
     }
   *search_arch_tail_ptr = new;
@@ -438,7 +446,7 @@ ldfile_add_arch (in_name)
 
 void
 ldfile_set_output_arch (string)
 
 void
 ldfile_set_output_arch (string)
-     CONST char *string;
+     const char *string;
 {
   const bfd_arch_info_type *arch = bfd_scan_arch (string);
 
 {
   const bfd_arch_info_type *arch = bfd_scan_arch (string);
 
This page took 0.041236 seconds and 4 git commands to generate.