From 395ccfce2105077efa9a951804f37ef707d74db1 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 12 Jul 1995 15:37:12 +0000 Subject: * 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. --- ld/ChangeLog | 25 +++++++++++++++++++++++++ ld/ldfile.c | 29 ++++++++++++++++------------- 2 files changed, 41 insertions(+), 13 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 8a3c7ad..1a1542e 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,28 @@ +Wed Jul 12 11:32:22 1995 Ian Lance Taylor + + * 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 + + * ldmain.c (set_scripts_dir): Don't base script directory on + current directory. + Tue Jul 11 12:29:02 1995 Rick Sladkey * ldmisc.c (vfinfo): Don't print the line number if it isn't diff --git a/ld/ldfile.c b/ld/ldfile.c index 5fd83ee..921b912 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -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 -- cgit v1.1