aboutsummaryrefslogtreecommitdiff
path: root/gold/options.h
diff options
context:
space:
mode:
authorChris Demetriou <cgd@google.com>2009-10-10 07:39:04 +0000
committerChris Demetriou <cgd@google.com>2009-10-10 07:39:04 +0000
commitae3b518947927146c76511c985cb372b2afab0da (patch)
tree813e1f1406d9851bf09a3f8ee622b93d7d37dc92 /gold/options.h
parentf08036905689c42e7d27f72c8a22c82812d23597 (diff)
downloadgdb-ae3b518947927146c76511c985cb372b2afab0da.zip
gdb-ae3b518947927146c76511c985cb372b2afab0da.tar.gz
gdb-ae3b518947927146c76511c985cb372b2afab0da.tar.bz2
2009-10-10 Chris Demetriou <cgd@google.com>
* options.h (Input_file_argument::Input_file_type): New enum. (Input_file_argument::is_lib_): Replace with... (Input_file_argument::type_): New member. (Input_file_argument::Input_file_argument): Take Input_file_type 'type' rather than boolean 'is_lib' as second argument. (Input_file_argument::is_lib): Use type_. (Input_file_argument::is_searched_file): New function. (Input_file_argument::may_need_search): Handle is_searched_file. * options.cc (General_options::parse_library): Support -l:filename. (General_options::parse_just_symbols): Update for Input_file_argument changes. (Command_line::process): Likewise. * archive.cc (Archive::get_file_and_offset): Likewise. * plugin.cc (Plugin_manager::release_input_file): Likewise. * script.cc (read_script_file, script_add_file): Likewise. * fileread.cc (Input_file::Input_file): Likewise. (Input_file::will_search_for): Handle is_searched_file. (Input_file::open): Likewise. * readsyms.cc (Read_symbols::get_name): Likewise. * testsuite/Makefile.am (searched_file_test): New test. * testsuite/Makefile.in: Regenerate. * testsuite/searched_file_test.cc: New file. * testsuite/searched_file_test_lib.cc: New file.
Diffstat (limited to 'gold/options.h')
-rw-r--r--gold/options.h41
1 files changed, 30 insertions, 11 deletions
diff --git a/gold/options.h b/gold/options.h
index 7266a96..848e648 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -1228,9 +1228,20 @@ class Position_dependent_options
class Input_file_argument
{
public:
+ enum Input_file_type
+ {
+ // A regular file, name used as-is, not searched.
+ INPUT_FILE_TYPE_FILE,
+ // A library name. When used, "lib" will be prepended and ".so" or
+ // ".a" appended to make a filename, and that filename will be searched
+ // for using the -L paths.
+ INPUT_FILE_TYPE_LIBRARY,
+ // A regular file, name used as-is, but searched using the -L paths.
+ INPUT_FILE_TYPE_SEARCHED_FILE
+ };
+
// name: file name or library name
- // is_lib: true if name is a library name: that is, emits the leading
- // "lib" and trailing ".so"/".a" from the name
+ // type: the type of this input file.
// extra_search_path: an extra directory to look for the file, prior
// to checking the normal library search path. If this is "",
// then no extra directory is added.
@@ -1238,15 +1249,15 @@ class Input_file_argument
// options: The position dependent options at this point in the
// command line, such as --whole-archive.
Input_file_argument()
- : name_(), is_lib_(false), extra_search_path_(""), just_symbols_(false),
- options_()
+ : name_(), type_(INPUT_FILE_TYPE_FILE), extra_search_path_(""),
+ just_symbols_(false), options_()
{ }
- Input_file_argument(const char* name, bool is_lib,
+ Input_file_argument(const char* name, Input_file_type type,
const char* extra_search_path,
bool just_symbols,
const Position_dependent_options& options)
- : name_(name), is_lib_(is_lib), extra_search_path_(extra_search_path),
+ : name_(name), type_(type), extra_search_path_(extra_search_path),
just_symbols_(just_symbols), options_(options)
{ }
@@ -1254,11 +1265,11 @@ class Input_file_argument
// Position_dependent_options. In that case, we extract the
// position-independent vars from the General_options and only store
// those.
- Input_file_argument(const char* name, bool is_lib,
+ Input_file_argument(const char* name, Input_file_type type,
const char* extra_search_path,
bool just_symbols,
const General_options& options)
- : name_(name), is_lib_(is_lib), extra_search_path_(extra_search_path),
+ : name_(name), type_(type), extra_search_path_(extra_search_path),
just_symbols_(just_symbols), options_(options)
{ }
@@ -1272,7 +1283,11 @@ class Input_file_argument
bool
is_lib() const
- { return this->is_lib_; }
+ { return type_ == INPUT_FILE_TYPE_LIBRARY; }
+
+ bool
+ is_searched_file() const
+ { return type_ == INPUT_FILE_TYPE_SEARCHED_FILE; }
const char*
extra_search_path() const
@@ -1291,14 +1306,18 @@ class Input_file_argument
// options.
bool
may_need_search() const
- { return this->is_lib_ || !this->extra_search_path_.empty(); }
+ {
+ return (this->is_lib()
+ || this->is_searched_file()
+ || !this->extra_search_path_.empty());
+ }
private:
// We use std::string, not const char*, here for convenience when
// using script files, so that we do not have to preserve the string
// in that case.
std::string name_;
- bool is_lib_;
+ Input_file_type type_;
std::string extra_search_path_;
bool just_symbols_;
Position_dependent_options options_;