aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <respindola@mozilla.com>2010-03-22 14:18:24 +0000
committerRafael Ávila de Espíndola <respindola@mozilla.com>2010-03-22 14:18:24 +0000
commitb0193076dad64abdb42ed0057ad668eaf3c17c7a (patch)
tree52ff18d9073b353700e411c07b9cf8ad4f7c50f5 /gold/options.cc
parentUse STRING_COMMA_LEN to avoid strlen. (diff)
downloadbinutils-gdb-b0193076dad64abdb42ed0057ad668eaf3c17c7a.tar.gz
binutils-gdb-b0193076dad64abdb42ed0057ad668eaf3c17c7a.tar.bz2
binutils-gdb-b0193076dad64abdb42ed0057ad668eaf3c17c7a.zip
2010-03-22 Rafael Espindola <espindola@google.com>
* archive.cc (Should_include): Move to archive.h. (should_include_member): Make it a member of Archive. (Lib_group): New. (Add_lib_group_symbols): New. * archive.h: Include options.h. (Archive_member): Moved from Archive. (Should_include): Moved from archive.cc. (Lib_group): New. (Add_lib_group_symbols): New. * dynobj.cc (do_should_include_member): New. * dynobj.h (do_should_include_member): New. * gold.cc (queue_initial_tasks): Update call to queue. * main.cc (main): Print lib group stats. * object.cc (do_should_include_member): New. * object.h: Include archive.h. (Object::should_include_member): New. (Object::do_should_include_member): New. (Sized_relobj::do_should_include_member): New. * options.cc (General_options::parse_start_lib): New. (General_options::parse_end_lib): New. (Input_arguments::add_file): Handle lib groups. (Input_arguments::start_group): Check we are not in a lib. (Input_arguments::start_lib): New. (Input_arguments::end_lib): New. * options.h (General_options): Add start_lib and end_lib. (Input_argument::lib_): New. (Input_argument::lib): New. (Input_argument::is_lib): New. (Input_file_lib): New. (Input_arguments::in_lib_): New. (Input_arguments::in_lib): New. (Input_arguments::start_lib): New. (Input_arguments::end_lib_): New. * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols in unused members as preempted. (Sized_pluginobj::do_should_include_member): New. * plugin.h (Sized_pluginobj::do_should_include_member): New. * readsyms.cc (Read_symbols::locks): If we are just reading a member, return the blocker. (Read_symbols::do_whole_lib_group): New. (Read_symbols::do_lib_group): New. (Read_symbols::do_read_symbols): Handle lib groups. (Read_symbols::get_name): Handle lib groups. * readsyms.h (Read_symbols): Add an archive member pointer. (Read_symbols::do_whole_lib_group): New. (Read_symbols::do_lib_group): New. (Read_symbols::member_): New. * script.cc (read_input_script): Update call to queue_soon.
Diffstat (limited to 'gold/options.cc')
-rw-r--r--gold/options.cc52
1 files changed, 49 insertions, 3 deletions
diff --git a/gold/options.cc b/gold/options.cc
index c6c8073683a..0eb38ada837 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -499,6 +499,20 @@ General_options::parse_end_group(const char*, const char*,
cmdline->inputs().end_group();
}
+void
+General_options::parse_start_lib(const char*, const char*,
+ Command_line* cmdline)
+{
+ cmdline->inputs().start_lib(cmdline->position_dependent_options());
+}
+
+void
+General_options::parse_end_lib(const char*, const char*,
+ Command_line* cmdline)
+{
+ cmdline->inputs().end_lib();
+}
+
// The function add_excluded_libs() in ld/ldlang.c of GNU ld breaks up a list
// of names seperated by commas or colons and puts them in a linked list.
// We implement the same parsing of names here but store names in an unordered
@@ -1161,14 +1175,20 @@ Search_directory::add_sysroot(const char* sysroot,
void
Input_arguments::add_file(const Input_file_argument& file)
{
- if (!this->in_group_)
- this->input_argument_list_.push_back(Input_argument(file));
- else
+ if (this->in_group_)
{
gold_assert(!this->input_argument_list_.empty());
gold_assert(this->input_argument_list_.back().is_group());
this->input_argument_list_.back().group()->add_file(file);
}
+ else if (this->in_lib_)
+ {
+ gold_assert(!this->input_argument_list_.empty());
+ gold_assert(this->input_argument_list_.back().is_lib());
+ this->input_argument_list_.back().lib()->add_file(file);
+ }
+ else
+ this->input_argument_list_.push_back(Input_argument(file));
}
// Start a group.
@@ -1178,6 +1198,8 @@ Input_arguments::start_group()
{
if (this->in_group_)
gold_fatal(_("May not nest groups"));
+ if (this->in_lib_)
+ gold_fatal(_("may not nest groups in libraries"));
Input_file_group* group = new Input_file_group();
this->input_argument_list_.push_back(Input_argument(group));
this->in_group_ = true;
@@ -1193,6 +1215,30 @@ Input_arguments::end_group()
this->in_group_ = false;
}
+// Start a lib.
+
+void
+Input_arguments::start_lib(const Position_dependent_options& options)
+{
+ if (this->in_lib_)
+ gold_fatal(_("may not nest libraries"));
+ if (this->in_group_)
+ gold_fatal(_("may not nest libraries in groups"));
+ Input_file_lib* lib = new Input_file_lib(options);
+ this->input_argument_list_.push_back(Input_argument(lib));
+ this->in_lib_ = true;
+}
+
+// End a lib.
+
+void
+Input_arguments::end_lib()
+{
+ if (!this->in_lib_)
+ gold_fatal(_("lib end without lib start"));
+ this->in_lib_ = false;
+}
+
// Command_line options.
Command_line::Command_line()