* 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.
This commit is contained in:
Ian Lance Taylor 1995-07-12 15:37:12 +00:00
parent e4f35679a9
commit 395ccfce21
2 changed files with 41 additions and 13 deletions

View 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> 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 * ldmisc.c (vfinfo): Don't print the line number if it isn't

View File

@ -25,6 +25,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307
#include "bfd.h" #include "bfd.h"
#include "sysdep.h" #include "sysdep.h"
#include "bfdlink.h"
#include "ld.h" #include "ld.h"
#include "ldmisc.h" #include "ldmisc.h"
#include "ldexp.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_head;
static search_arch_type **search_arch_tail_ptr = &search_arch_head; static search_arch_type **search_arch_tail_ptr = &search_arch_head;
static boolean try_open_bfd PARAMS ((const char *attempt, static boolean ldfile_open_file_search
lang_input_statement_type *entry)); 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)); static FILE *try_open PARAMS ((const char *name, const char *exten));
void void
@ -89,8 +91,8 @@ ldfile_add_library_path (name, cmdline)
/* Try to open a BFD for a lang_input_statement. */ /* Try to open a BFD for a lang_input_statement. */
static boolean boolean
try_open_bfd (attempt, entry) ldfile_try_open_bfd (attempt, entry)
const char *attempt; const char *attempt;
lang_input_statement_type *entry; 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 /* Search for and open the file specified by ENTRY. If it is an
archive, use ARCH, LIB and SUFFIX to modify the file name. */ archive, use ARCH, LIB and SUFFIX to modify the file name. */
boolean static boolean
ldfile_open_file_search (arch, entry, lib, suffix) ldfile_open_file_search (arch, entry, lib, suffix)
const char *arch; const char *arch;
lang_input_statement_type *entry; lang_input_statement_type *entry;
@ -122,7 +124,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
directory first. */ directory first. */
if (! entry->is_archive) if (! entry->is_archive)
{ {
if (try_open_bfd (entry->filename, entry)) if (ldfile_try_open_bfd (entry->filename, entry))
return true; return true;
} }
@ -132,6 +134,12 @@ ldfile_open_file_search (arch, entry, lib, suffix)
{ {
char *string; char *string;
if (entry->dynamic && ! link_info.relocateable)
{
if (ldemul_open_dynamic_archive (arch, search, entry))
return true;
}
string = (char *) xmalloc (strlen (search->name) string = (char *) xmalloc (strlen (search->name)
+ strlen (slash) + strlen (slash)
+ strlen (lib) + strlen (lib)
@ -148,7 +156,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
else else
sprintf (string, "%s%s%s", search->name, slash, entry->filename); 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; entry->filename = string;
return true; return true;
@ -171,7 +179,7 @@ ldfile_open_file (entry)
if (! entry->search_dirs_flag) if (! entry->search_dirs_flag)
{ {
if (try_open_bfd (entry->filename, entry)) if (ldfile_try_open_bfd (entry->filename, entry))
return; return;
} }
else else
@ -183,11 +191,6 @@ ldfile_open_file (entry)
arch != (search_arch_type *) NULL; arch != (search_arch_type *) NULL;
arch = arch->next) 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")) if (ldfile_open_file_search (arch->name, entry, "lib", ".a"))
return; return;
#ifdef VMS #ifdef VMS