summaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorespindola <espindola>2010-07-13 14:59:02 +0000
committerespindola <espindola>2010-07-13 14:59:02 +0000
commitc57c768ab65354cf4dacf1d5a3fa1e18467429dd (patch)
tree306df352fa01fa64ebd9c740f635e9f4b276a40d /gold
parentd980a0ef648038ebc3f18ea64ef0e7af31d57c75 (diff)
downloadbinutils-redhat-c57c768ab65354cf4dacf1d5a3fa1e18467429dd.tar.gz
2010-07-13 Rafael Espindola <espindola@google.com>
* fileread.cc (try_extra_search_path, find_file): Move to Input_file. * fileread.h (Input_file): Add try_extra_search_path and find_file.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog5
-rw-r--r--gold/fileread.cc35
-rw-r--r--gold/fileread.h14
3 files changed, 39 insertions, 15 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 8d7526961c..6dbbceda0d 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-13 Rafael Espindola <espindola@google.com>
+
+ * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
+ * fileread.h (Input_file): Add try_extra_search_path and find_file.
+
2010-07-13 Philip Herron <herron.philip@googlemail.com>
Ian Lance Taylor <iant@google.com>
diff --git a/gold/fileread.cc b/gold/fileread.cc
index bfab1a47f8..0c3cb9504b 100644
--- a/gold/fileread.cc
+++ b/gold/fileread.cc
@@ -841,17 +841,19 @@ File_read::get_mtime()
#endif
}
-// Try to find a file in the extra search dirs. Returns true on success.
+// Try to find a file in the extra search dirs. Returns true on success.
-static bool
-try_extra_search_path(int* pindex, const Input_file_argument* input_argument,
- std::string filename, std::string* found_name,
- std::string* namep) {
+bool
+Input_file::try_extra_search_path(int* pindex,
+ const Input_file_argument* input_argument,
+ std::string filename, std::string* found_name,
+ std::string* namep)
+{
if (input_argument->extra_search_path() == NULL)
return false;
std::string name = input_argument->extra_search_path();
- if (!IS_DIR_SEPARATOR (name[name.length() - 1]))
+ if (!IS_DIR_SEPARATOR(name[name.length() - 1]))
name += '/';
name += filename;
@@ -873,10 +875,11 @@ try_extra_search_path(int* pindex, const Input_file_argument* input_argument,
// In each, we look in extra_search_path + library_path to find
// the file location, rather than the current directory.
-static bool
-find_file(const Dirsearch& dirpath, int* pindex,
- const Input_file_argument* input_argument, bool* is_in_sysroot,
- std::string* found_name, std::string* namep)
+bool
+Input_file::find_file(const Dirsearch& dirpath, int* pindex,
+ const Input_file_argument* input_argument,
+ bool* is_in_sysroot,
+ std::string* found_name, std::string* namep)
{
std::string name;
@@ -914,11 +917,13 @@ find_file(const Dirsearch& dirpath, int* pindex,
else
n1 = input_argument->name();
- if (try_extra_search_path(pindex, input_argument, n1, found_name, namep))
+ if (Input_file::try_extra_search_path(pindex, input_argument, n1,
+ found_name, namep))
return true;
- if (!n2.empty() && try_extra_search_path(pindex, input_argument, n2,
- found_name, namep))
+ if (!n2.empty() && Input_file::try_extra_search_path(pindex,
+ input_argument, n2,
+ found_name, namep))
return true;
// It is not in the extra_search_path.
@@ -969,8 +974,8 @@ bool
Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex)
{
std::string name;
- if (!find_file(dirpath, pindex, this->input_argument_, &this->is_in_sysroot_,
- &this->found_name_, &name))
+ if (!Input_file::find_file(dirpath, pindex, this->input_argument_,
+ &this->is_in_sysroot_, &this->found_name_, &name))
return false;
// Now that we've figured out where the file lives, try to open it.
diff --git a/gold/fileread.h b/gold/fileread.h
index a81b5fe40f..3a8f93289e 100644
--- a/gold/fileread.h
+++ b/gold/fileread.h
@@ -565,6 +565,20 @@ class Input_file
format() const
{ return this->format_; }
+ // Try to find a file in the extra search dirs. Returns true on success.
+ static bool
+ try_extra_search_path(int* pindex,
+ const Input_file_argument* input_argument,
+ std::string filename, std::string* found_name,
+ std::string* namep);
+
+ // Find the actual file.
+ static bool
+ find_file(const Dirsearch& dirpath, int* pindex,
+ const Input_file_argument* input_argument,
+ bool* is_in_sysroot,
+ std::string* found_name, std::string* namep);
+
private:
Input_file(const Input_file&);
Input_file& operator=(const Input_file&);