/* Linker file opening and searching.
- Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002
+ Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
#include "libiberty.h"
const char *ldfile_input_filename;
-boolean ldfile_assumed_script = false;
+bfd_boolean ldfile_assumed_script = FALSE;
const char *ldfile_output_machine_name = "";
unsigned long ldfile_output_machine;
enum bfd_architecture ldfile_output_architecture;
void
ldfile_add_library_path (name, cmdline)
const char *name;
- boolean cmdline;
+ bfd_boolean cmdline;
{
search_dirs_type *new;
new->cmdline = cmdline;
*search_tail_ptr = new;
search_tail_ptr = &new->next;
+
+ /* If a directory is marked as honoring sysroot, prepend the sysroot path
+ now. */
+ if (new->name[0] == '=')
+ new->name = concat (ld_sysroot, &new->name[1], NULL);
}
/* Try to open a BFD for a lang_input_statement. */
-boolean
+bfd_boolean
ldfile_try_open_bfd (attempt, entry)
const char *attempt;
lang_input_statement_type *entry;
{
if (bfd_get_error () == bfd_error_invalid_target)
einfo (_("%F%P: invalid BFD target `%s'\n"), entry->target);
- return false;
+ return FALSE;
}
/* If we are searching for this file, see if the architecture is
/* Try to interpret the file as a linker script. */
ldfile_open_command_file (attempt);
-
- ldfile_assumed_script = true;
+
+ ldfile_assumed_script = TRUE;
parser_input = input_selected;
ldlex_both ();
token = INPUT_SCRIPT;
}
token = yylex ();
}
- ldfile_assumed_script = false;
+ ldfile_assumed_script = FALSE;
fclose (yyin);
yyin = NULL;
if (skip)
attempt, entry->local_sym_name);
bfd_close (entry->the_bfd);
entry->the_bfd = NULL;
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
- if ((bfd_arch_get_compatible (check, output_bfd) == NULL)
- /* XCOFF archives can have 32 and 64 bit objects */
+ if ((bfd_arch_get_compatible (check, output_bfd,
+ command_line.accept_unknown_input_arch) == NULL)
+ /* XCOFF archives can have 32 and 64 bit objects. */
&& ! (bfd_get_flavour (check) == bfd_target_xcoff_flavour
&& bfd_get_flavour (output_bfd) == bfd_target_xcoff_flavour
&& bfd_check_format (entry->the_bfd, bfd_archive)))
attempt, entry->local_sym_name);
bfd_close (entry->the_bfd);
entry->the_bfd = NULL;
- return false;
+ return FALSE;
}
}
}
- return true;
+ return TRUE;
}
/* 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
+bfd_boolean
ldfile_open_file_search (arch, entry, lib, suffix)
const char *arch;
lang_input_statement_type *entry;
if (! entry->is_archive)
{
if (ldfile_try_open_bfd (entry->filename, entry))
- return true;
+ return TRUE;
}
for (search = search_head;
if (entry->dynamic && ! link_info.relocateable)
{
if (ldemul_open_dynamic_archive (arch, search, entry))
- return true;
+ return TRUE;
}
string = (char *) xmalloc (strlen (search->name)
if (ldfile_try_open_bfd (string, entry))
{
entry->filename = string;
- return true;
+ return TRUE;
}
free (string);
}
- return false;
+ return FALSE;
}
/* Open the input file specified by ENTRY. */
else
{
search_arch_type *arch;
- boolean found = false;
+ bfd_boolean found = FALSE;
/* Try to open <filename><suffix> or lib<filename><suffix>.a */
for (arch = search_arch_head;
/* If we have found the file, we don't need to search directories
again. */
if (found)
- entry->search_dirs_flag = false;
+ entry->search_dirs_flag = FALSE;
else
einfo (_("%F%P: cannot find %s\n"), entry->local_sym_name);
}
}
/* Try to open NAME; if that fails, look for it in any directories
- specified with -L, without and with EXTEND apppended. */
+ specified with -L, without and with EXTEND appended. */
FILE *
ldfile_find_command_file (name, extend)