* ldemul.h (ldemul_open_dynamic_archive): Add search parameter to
authorIan Lance Taylor <ian@airs.com>
Wed, 12 Jul 1995 15:37:12 +0000 (15:37 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 12 Jul 1995 15:37:12 +0000 (15:37 +0000)
declaration.
(ld_emulation_xfer_type): Add search parameter to
open_dynamic_archive entry point.
* ldemul.c (ldemul_open_dynamic_archive): Add search parameter.
* ldfile.c (ldfile_try_open_bfd): Rename from try_open_bfd, and
make non-static.  Change all callers to use new name.
(ldfile_open_file_search): Make static.  If entry is dynamic, call
ldemul_open_dynamic_archive.
(ldfile_open_file): Don't call ldemul_open_dynamic_archive.
* ldfile.h (ldfile_open_file_search): Don't declare.
(ldfile_try_open_bfd): Declare.
* emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
Accept search parameter.  Don't search for a library, just look in
a single place.
* emultempl/linux.em (gld${EMULATION_NAME}_open_dynamic_archive):
Likewise.

ld/ChangeLog
ld/ldfile.c

index 8a3c7adae8b1ba010e0701341ca0334a9fd8503d..1a1542eed7d8e04e576864d296bdea01aa82774e 100644 (file)
@@ -1,3 +1,28 @@
+Wed Jul 12 11:32:22 1995  Ian Lance Taylor  <ian@cygnus.com>
+
+       * ldemul.h (ldemul_open_dynamic_archive): Add search parameter to
+       declaration.
+       (ld_emulation_xfer_type): Add search parameter to
+       open_dynamic_archive entry point.
+       * ldemul.c (ldemul_open_dynamic_archive): Add search parameter.
+       * ldfile.c (ldfile_try_open_bfd): Rename from try_open_bfd, and
+       make non-static.  Change all callers to use new name.
+       (ldfile_open_file_search): Make static.  If entry is dynamic, call
+       ldemul_open_dynamic_archive.
+       (ldfile_open_file): Don't call ldemul_open_dynamic_archive.
+       * ldfile.h (ldfile_open_file_search): Don't declare.
+       (ldfile_try_open_bfd): Declare.
+       * emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
+       Accept search parameter.  Don't search for a library, just look in
+       a single place.
+       * emultempl/linux.em (gld${EMULATION_NAME}_open_dynamic_archive):
+       Likewise.
+
+Tue Jul 11 16:44:21 1995  Ian Lance Taylor  <ian@cygnus.com>
+
+       * ldmain.c (set_scripts_dir): Don't base script directory on
+       current directory.
+
 Tue Jul 11 12:29:02 1995  Rick Sladkey  <jrs@world.std.com>
 
        * ldmisc.c (vfinfo): Don't print the line number if it isn't
index 5fd83eef0bb3ddb9d22f3e81177081263633113e..921b9127c4325dd7ae9aed39eef761e0786b5af1 100644 (file)
@@ -25,6 +25,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307
 
 #include "bfd.h"
 #include "sysdep.h"
+#include "bfdlink.h"
 #include "ld.h"
 #include "ldmisc.h"
 #include "ldexp.h"
@@ -68,8 +69,9 @@ typedef struct search_arch
 static search_arch_type *search_arch_head;
 static search_arch_type **search_arch_tail_ptr = &search_arch_head;
  
-static boolean try_open_bfd PARAMS ((const char *attempt,
-                                    lang_input_statement_type *entry));
+static boolean ldfile_open_file_search
+  PARAMS ((const char *arch, lang_input_statement_type *,
+          const char *lib, const char *suffix));
 static FILE *try_open PARAMS ((const char *name, const char *exten));
 
 void
@@ -89,8 +91,8 @@ ldfile_add_library_path (name, cmdline)
 
 /* Try to open a BFD for a lang_input_statement.  */
 
-static boolean
-try_open_bfd (attempt, entry)
+boolean
+ldfile_try_open_bfd (attempt, entry)
      const char *attempt;
      lang_input_statement_type *entry;
 {
@@ -109,7 +111,7 @@ try_open_bfd (attempt, entry)
 /* Search for and open the file specified by ENTRY.  If it is an
    archive, use ARCH, LIB and SUFFIX to modify the file name.  */
 
-boolean
+static boolean
 ldfile_open_file_search (arch, entry, lib, suffix)
      const char *arch;
      lang_input_statement_type *entry;
@@ -122,7 +124,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
      directory first.  */
   if (! entry->is_archive)
     {
-      if (try_open_bfd (entry->filename, entry))
+      if (ldfile_try_open_bfd (entry->filename, entry))
        return true;
     }
 
@@ -132,6 +134,12 @@ ldfile_open_file_search (arch, entry, lib, suffix)
     {
       char *string;
 
+      if (entry->dynamic && ! link_info.relocateable)
+       {
+         if (ldemul_open_dynamic_archive (arch, search, entry))
+           return true;
+       }
+
       string = (char *) xmalloc (strlen (search->name)
                                 + strlen (slash)
                                 + strlen (lib)
@@ -148,7 +156,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
       else
        sprintf (string, "%s%s%s", search->name, slash, entry->filename);
 
-      if (try_open_bfd (string, entry))
+      if (ldfile_try_open_bfd (string, entry))
        {
          entry->filename = string;
          return true;
@@ -171,7 +179,7 @@ ldfile_open_file (entry)
 
   if (! entry->search_dirs_flag)
     {
-      if (try_open_bfd (entry->filename, entry))
+      if (ldfile_try_open_bfd (entry->filename, entry))
        return;
     }
   else
@@ -183,11 +191,6 @@ ldfile_open_file (entry)
           arch != (search_arch_type *) NULL;
           arch = arch->next)
        {
-         if (config.dynamic_link)
-           {
-             if (ldemul_open_dynamic_archive (arch->name, entry))
-               return;
-           }
          if (ldfile_open_file_search (arch->name, entry, "lib", ".a"))
            return;
 #ifdef VMS