* options.h (class Search_directory): Add is_system_directory.
	(class General_options): Declare is_in_system_directory.
	* options.cc (get_relative_sysroot): Make static.
	(get_default_sysroot): Make static.
	(General_optoins::is_in_system_directory): New function.
	* fileread.cc (Input_file::is_in_system_directory): New function.
	* fileread.h (class Input_file): Declare is_in_system_directory.
	* object.h (class Object): Add is_in_system_directory.
	(class Input_objects): Remove system_library_directory_ field.
	* object.cc (Input_objects::add_object): Don't set
	system_library_directory_.
	(input_objects::found_in_system_library_directory): Remove.
	* symtab.cc (Symbol_table::write_globals): Remove input_objects
	parameter.  Change all callers.
	(Symbol_table::sized_write_globals): Likewise.
	(Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
	Call Object::is_in_system_directory.
	* symtab.h (class Symbol_table): Update declarations.
This commit is contained in:
Ian Lance Taylor
2009-02-28 04:39:57 +00:00
parent 61edd21fa4
commit fd9d194f04
10 changed files with 100 additions and 60 deletions

View File

@@ -1,6 +1,6 @@
// options.c -- handle command line options for gold
// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -451,7 +451,7 @@ string_to_object_format(const char* arg)
// If the default sysroot is relocatable, try relocating it based on
// the prefix FROM.
char*
static char*
get_relative_sysroot(const char* from)
{
char* path = make_relative_prefix(gold::program_name, from,
@@ -472,7 +472,7 @@ get_relative_sysroot(const char* from)
// get_relative_sysroot, which is a small memory leak, but is
// necessary since we store this pointer directly in General_options.
const char*
static const char*
get_default_sysroot()
{
const char* sysroot = TARGET_SYSTEM_ROOT;
@@ -684,6 +684,26 @@ General_options::add_sysroot()
free(canonical_sysroot);
}
// Return whether FILENAME is in a system directory.
bool
General_options::is_in_system_directory(const std::string& filename) const
{
for (Dir_list::const_iterator p = this->library_path_.value.begin();
p != this->library_path_.value.end();
++p)
{
// We use a straight string comparison rather than calling
// FILENAME_CMP because we are only interested in the cases
// where we found the file in a system directory, which means
// that we used the directory name as a prefix for a -L search.
if (p->is_system_directory()
&& filename.compare(0, p->name().size(), p->name()) == 0)
return true;
}
return false;
}
// Add a plugin to the list of plugins.
void