]> Git Repo - binutils.git/blobdiff - ld/ldfile.c
Add support for ARM-PE.
[binutils.git] / ld / ldfile.c
index 43e9575d33764d6cb3774507799080045839920f..f084d36a837df34f1ab3a625192cff164692d7b2 100644 (file)
@@ -40,6 +40,7 @@ char *ldfile_input_filename;
 const char *ldfile_output_machine_name = "";
 unsigned long ldfile_output_machine;
 enum bfd_architecture ldfile_output_architecture;
+search_dirs_type *search_head;
 
 /* start-sanitize-mpw */
 #ifndef MPW
@@ -56,17 +57,8 @@ char *slash = ":";
 #endif /* MPW */
 /* end-sanitize-mpw */
 
-
-
-
 /* LOCAL */
-typedef struct search_dirs 
-{
-  char *name;
-  struct search_dirs *next;
-} search_dirs_type;
 
-static search_dirs_type *search_head;
 static search_dirs_type **search_tail_ptr = &search_head;
 
 typedef struct search_arch 
@@ -85,13 +77,16 @@ static bfd *open_a PARAMS ((char *arch, lang_input_statement_type *entry,
 static FILE *try_open PARAMS ((char *name, char *exten));
 
 void
-ldfile_add_library_path(name)
-char *name;
+ldfile_add_library_path (name, cmdline)
+     const char *name;
+     boolean cmdline;
 {
-  search_dirs_type *new =
-    (search_dirs_type *)xmalloc((bfd_size_type)(sizeof(search_dirs_type)));
+  search_dirs_type *new;
+
+  new = (search_dirs_type *) xmalloc (sizeof (search_dirs_type));
+  new->next = NULL;
   new->name = name;
-  new->next = (search_dirs_type*)NULL;
+  new->cmdline = cmdline;
   *search_tail_ptr = new;
   search_tail_ptr = &new->next;
 }
@@ -119,6 +114,16 @@ open_a(arch, entry, lib, suffix)
 {
   bfd*desc;
   search_dirs_type *search ;
+
+  /* If this is not an archive, try to open it in the current
+     directory first.  */
+  if (! entry->is_archive)
+    {
+      desc = cached_bfd_openr (entry->filename, entry);
+      if (desc != NULL)
+       return desc;
+    }
+
   for (search = search_head;
        search != (search_dirs_type *)NULL;
        search = search->next) 
@@ -145,7 +150,6 @@ open_a(arch, entry, lib, suffix)
       if (desc)
        {
          entry->filename = string;
-         entry->search_dirs_flag = false;
          entry->the_bfd =  desc;
          return desc;
        }
@@ -162,8 +166,7 @@ void
 ldfile_open_file (entry)
      lang_input_statement_type *entry;
 {
-  if (entry->superfile != NULL)
-    ldfile_open_file (entry->superfile);
+  ASSERT (entry->the_bfd == NULL);
 
   if (! entry->search_dirs_flag)
     entry->the_bfd = cached_bfd_openr (entry->filename, entry);
This page took 0.024602 seconds and 4 git commands to generate.