aboutsummaryrefslogtreecommitdiff
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
commite3f2db7fa69d2c1f4c7dbee442da6b262c706700 (patch)
treec1c9691a2ba1728c3b9dcaac761845c83524bd57 /ld/ldfile.c
parent832a94844fffdf222dd6726c26d2678daf440202 (diff)
downloadgdb-e3f2db7fa69d2c1f4c7dbee442da6b262c706700.zip
gdb-e3f2db7fa69d2c1f4c7dbee442da6b262c706700.tar.gz
gdb-e3f2db7fa69d2c1f4c7dbee442da6b262c706700.tar.bz2
* 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 bc1fd87..84795e1 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;
}