aboutsummaryrefslogtreecommitdiff
path: root/gold/options.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-02-28 04:39:57 +0000
committerIan Lance Taylor <ian@airs.com>2009-02-28 04:39:57 +0000
commitfd9d194f0467de25e3d6e6131d641f179d7eb289 (patch)
treec99595f96a991235d7001c53d9ba332abae711a4 /gold/options.cc
parent61edd21fa41ccf31fe391ee320c4812c4d45486a (diff)
downloadfsf-binutils-gdb-fd9d194f0467de25e3d6e6131d641f179d7eb289.zip
fsf-binutils-gdb-fd9d194f0467de25e3d6e6131d641f179d7eb289.tar.gz
fsf-binutils-gdb-fd9d194f0467de25e3d6e6131d641f179d7eb289.tar.bz2
PR 6811
* 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.
Diffstat (limited to 'gold/options.cc')
-rw-r--r--gold/options.cc26
1 files changed, 23 insertions, 3 deletions
diff --git a/gold/options.cc b/gold/options.cc
index 35ed863..3f6fbfa 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -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