summaryrefslogtreecommitdiff
path: root/ld/ldfile.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2003-03-03 20:00:35 +0000
committerAlexandre Oliva <aoliva@redhat.com>2003-03-03 20:00:35 +0000
commitdf9076abf90ec3d9d99be3b7772b8e9d9153bea5 (patch)
tree005c9b6aa1272f13eb19b98c8a329b4ed0fc12f8 /ld/ldfile.c
parent6ac3f544aa90871666c7b99b814bcbe8d6d73a80 (diff)
downloadbinutils-redhat-df9076abf90ec3d9d99be3b7772b8e9d9153bea5.tar.gz
* ldfile.h (struct search_dirs): Added sysrooted field.
* ldlang.h (struct lang_input_statement_struct): Likewise. * ldfile.c (ldfile_add_library_path): Mark sysrooted paths. (ldfile_open_file_search): Look for sysrooted filename starting with / in ld_sysroot instead of in the current directory. Clear sysrooted flag if it's found in the current directory. Set it from the search directory's sysrooted flag where it is found otherwise. * ldlang.c (ldlang_sysrooted_script): New static variable. (new_afile): Mark search_file_enums as sysrooted if ldlang_sysrooted_script. (load_symbols): Set ldlang_sysrooted_script according to the script's sysrooted field while processing it. * ld.texinfo: Document INPUT behavior in sysroot.
Diffstat (limited to 'ld/ldfile.c')
-rw-r--r--ld/ldfile.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/ld/ldfile.c b/ld/ldfile.c
index bc1fd87c3a..84795e1f68 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -92,7 +92,12 @@ ldfile_add_library_path (name, cmdline)
/* 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);
+ {
+ new->name = concat (ld_sysroot, &new->name[1], NULL);
+ new->sysrooted = TRUE;
+ }
+ else
+ new->sysrooted = FALSE;
}
/* Try to open a BFD for a lang_input_statement. */
@@ -265,8 +270,22 @@ ldfile_open_file_search (arch, entry, lib, suffix)
directory first. */
if (! entry->is_archive)
{
- if (ldfile_try_open_bfd (entry->filename, entry))
- return TRUE;
+ if (entry->sysrooted && entry->filename[0] == '/')
+ {
+ char *name = concat (ld_sysroot, entry->filename,
+ (const char *) NULL);
+ if (ldfile_try_open_bfd (name, entry))
+ {
+ entry->filename = name;
+ return TRUE;
+ }
+ free (name);
+ }
+ else if (ldfile_try_open_bfd (entry->filename, entry))
+ {
+ entry->sysrooted = FALSE;
+ return TRUE;
+ }
}
for (search = search_head;
@@ -278,7 +297,10 @@ ldfile_open_file_search (arch, entry, lib, suffix)
if (entry->dynamic && ! link_info.relocateable)
{
if (ldemul_open_dynamic_archive (arch, search, entry))
- return TRUE;
+ {
+ entry->sysrooted = search->sysrooted;
+ return TRUE;
+ }
}
string = (char *) xmalloc (strlen (search->name)
@@ -306,6 +328,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
if (ldfile_try_open_bfd (string, entry))
{
entry->filename = string;
+ entry->sysrooted = search->sysrooted;
return TRUE;
}