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
#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
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;
}
{
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)
if (desc)
{
entry->filename = string;
- entry->search_dirs_flag = false;
entry->the_bfd = desc;
return desc;
}
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);