+// Return whether this is a file that we will search for in the list
+// of directories.
+
+bool
+Input_file::will_search_for() const
+{
+ return (!IS_ABSOLUTE_PATH(this->input_argument_->name())
+ && (this->input_argument_->is_lib()
+ || this->input_argument_->is_searched_file()
+ || this->input_argument_->extra_search_path() != NULL));
+}
+
+// Return the file last modification time. Calls gold_fatal if the stat
+// system call failed.
+
+Timespec
+File_read::get_mtime()
+{
+ struct stat file_stat;
+ this->reopen_descriptor();
+
+ if (fstat(this->descriptor_, &file_stat) < 0)
+ gold_fatal(_("%s: stat failed: %s"), this->name_.c_str(),
+ strerror(errno));
+#ifdef HAVE_STAT_ST_MTIM
+ return Timespec(file_stat.st_mtim.tv_sec, file_stat.st_mtim.tv_nsec);
+#else
+ return Timespec(file_stat.st_mtime, 0);
+#endif
+}
+
+// Try to find a file in the extra search dirs. Returns true on success.
+
+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]))
+ name += '/';
+ name += filename;
+
+ struct stat dummy_stat;
+ if (*pindex > 0 || ::stat(name.c_str(), &dummy_stat) < 0)
+ return false;