From b0193076dad64abdb42ed0057ad668eaf3c17c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Mon, 22 Mar 2010 14:18:24 +0000 Subject: 2010-03-22 Rafael Espindola * 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. --- gold/plugin.cc | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'gold/plugin.cc') diff --git a/gold/plugin.cc b/gold/plugin.cc index 2831c2b..d9b4c59 100644 --- a/gold/plugin.cc +++ b/gold/plugin.cc @@ -438,6 +438,7 @@ Plugin_manager::add_input_file(char *pathname, bool is_lib) this->mapfile_, input_argument, NULL, + NULL, this->this_blocker_, next_blocker)); this->this_blocker_ = next_blocker; @@ -475,6 +476,17 @@ Pluginobj::get_symbol_resolution_info(int nsyms, ld_plugin_symbol* syms) const { if (nsyms > this->nsyms_) return LDPS_NO_SYMS; + + if (static_cast(nsyms) > this->symbols_.size()) + { + // We never decided to include this object. We mark all symbols as + // preempted. + gold_assert (this->symbols_.size() == 0); + for (int i = 0; i < nsyms; i++) + syms[i].resolution = LDPR_PREEMPTED_REG; + return LDPS_OK; + } + for (int i = 0; i < nsyms; i++) { ld_plugin_symbol* isym = &syms[i]; @@ -662,6 +674,34 @@ Sized_pluginobj::do_add_symbols(Symbol_table* symtab, } } +template +Archive::Should_include +Sized_pluginobj::do_should_include_member( + Symbol_table* symtab, Read_symbols_data*, std::string* why) +{ + char* tmpbuf = NULL; + size_t tmpbuflen = 0; + + for (int i = 0; i < this->nsyms_; ++i) { + const struct ld_plugin_symbol& sym = this->syms_[i]; + const char* name = sym.name; + Symbol* symbol; + Archive::Should_include t = Archive::should_include_member(symtab, name, + &symbol, why, + &tmpbuf, + &tmpbuflen); + if (t == Archive::SHOULD_INCLUDE_YES) + { + if (tmpbuf != NULL) + free(tmpbuf); + return t; + } + } + if (tmpbuf != NULL) + free(tmpbuf); + return Archive::SHOULD_INCLUDE_UNKNOWN; +} + // Get the size of a section. Not used for plugin objects. template -- cgit v1.1