aboutsummaryrefslogtreecommitdiff
path: root/gold/readsyms.cc
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2011-07-14 00:55:18 +0000
committerSriraman Tallam <tmsriram@google.com>2011-07-14 00:55:18 +0000
commite9552f7ebbcd2438fe50dbf1fb4b1926c96adb75 (patch)
tree3011912bed63e6f4668b55cafab0fd7c3efcc1e5 /gold/readsyms.cc
parent41d1d0bd9b0e58444eb9abedcf8bc02c78deaced (diff)
downloadgdb-e9552f7ebbcd2438fe50dbf1fb4b1926c96adb75.zip
gdb-e9552f7ebbcd2438fe50dbf1fb4b1926c96adb75.tar.gz
gdb-e9552f7ebbcd2438fe50dbf1fb4b1926c96adb75.tar.bz2
2011-07-13 Sriraman Tallam <tmsriram@google.com>
* plugin-api.h (ld_plugin_section): New struct. (ld_plugin_get_section_count): New typedef. (ld_plugin_get_section_type): New typedef. (ld_plugin_get_section_name): New typedef. (ld_plugin_get_section_contents): New typedef. (ld_plugin_update_section_order): New typedef. (ld_plugin_allow_section_ordering): New typedef. (LDPT_GET_SECTION_COUNT): New enum value. (LDPT_GET_SECTION_TYPE): New enum value. (LDPT_GET_SECTION_NAME): New enum value. (LDPT_GET_SECTION_CONTENTS): New enum value. (LDPT_UPDATE_SECTION_ORDER): New enum value. (LDPT_ALLOW_SECTION_ORDERING): New enum value. (tv_get_section_count): New struct members. (tv_get_section_type): New struct members. (tv_get_section_name): New struct members. (tv_get_section_contents): New struct members. (tv_update_section_order): New struct members. (tv_allow_section_ordering): New struct members. * archive.cc (Archive::get_elf_object_for_member): Add extra parameter to claim_file call. * layout.cc (Layout::Layout): Initialize section_ordering_specified_, input_section_position_, and input_section_glob_. (read_layout_from_file): Call function section_ordering_specified. * layout.h (is_section_ordering_specified): New function. (section_ordering_specified): New function. (section_ordering_specified_): New boolean member. * main.cc(main): Call load_plugins after layout object is defined. * output.cc (Output_section::add_input_section): Use function section_ordering_specified to check if section ordering is needed. * output.cc (Output_section::add_relaxed_input_section): Use function section_ordering_specified to check if section ordering is needed. (Output_section::update_section_layout): New function. (Output_section::sort_attached_input_sections): Check if input section must be reordered. * output.h (Output_section::update_section_layout): New function. * plugin.cc (get_section_count): New function. (get_section_type): New function. (get_section_name): New function. (get_section_contents): New function. (update_section_order): New function. (allow_section_ordering): New function. (Plugin::load): Add the new interfaces to the transfer vector. (Plugin_manager::load_plugins): New parameter. (Plugin_manager::all_symbols_read): New parameter. (Plugin_manager::claim_file): New parameter. Save the elf object for unclaimed objects. (Plugin_manager::get_elf_object): New function. (Plugin_manager::get_view): Change to directly use the bool to check if get_view is called from claim_file_hook. * plugin.h (input_objects): New function (Plugin__manager::load_plugins): New parameter. (Plugin_manager::claim_file): New parameter. (Plugin_manager::get_elf_object): New function. (Plugin_manager::in_claim_file_handler): New function. (Plugin_manager::in_claim_file_handler_): New member. (layout): New function. * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file handler with an extra parameter. Make the elf object before calling claim_file handler. * testsuite/plugin_test.c (get_section_count): New function pointer. (get_section_type): New function pointer. (get_section_name): New function pointer. (get_section_contents): New function pointer. (update_section_order): New function pointer. (allow_section_ordering): New function pointer. (onload): Check if the new interfaces exist.
Diffstat (limited to 'gold/readsyms.cc')
-rw-r--r--gold/readsyms.cc38
1 files changed, 26 insertions, 12 deletions
diff --git a/gold/readsyms.cc b/gold/readsyms.cc
index 574cb72..1e50942 100644
--- a/gold/readsyms.cc
+++ b/gold/readsyms.cc
@@ -320,12 +320,33 @@ Read_symbols::do_read_symbols(Workqueue* workqueue)
}
}
+ Object* elf_obj = NULL;
+ bool unconfigured;
+ bool* punconfigured = NULL;
+ if (is_elf)
+ {
+ // This is an ELF object.
+
+ unconfigured = false;
+ punconfigured = (input_file->will_search_for()
+ ? &unconfigured
+ : NULL);
+ elf_obj = make_elf_object(input_file->filename(),
+ input_file, 0, ehdr, read_size,
+ punconfigured);
+ }
+
if (parameters->options().has_plugins())
{
Pluginobj* obj = parameters->options().plugins()->claim_file(input_file,
- 0, filesize);
+ 0, filesize,
+ elf_obj);
if (obj != NULL)
{
+ // Delete the elf_obj, this file has been claimed.
+ if (elf_obj != NULL)
+ delete elf_obj;
+
// The input file was claimed by a plugin, and its symbols
// have been provided by the plugin.
@@ -359,14 +380,7 @@ Read_symbols::do_read_symbols(Workqueue* workqueue)
{
// This is an ELF object.
- bool unconfigured = false;
- bool* punconfigured = (input_file->will_search_for()
- ? &unconfigured
- : NULL);
- Object* obj = make_elf_object(input_file->filename(),
- input_file, 0, ehdr, read_size,
- punconfigured);
- if (obj == NULL)
+ if (elf_obj == NULL)
{
if (unconfigured)
{
@@ -382,7 +396,7 @@ Read_symbols::do_read_symbols(Workqueue* workqueue)
}
Read_symbols_data* sd = new Read_symbols_data;
- obj->read_symbols(sd);
+ elf_obj->read_symbols(sd);
// Opening the file locked it, so now we need to unlock it. We
// need to unlock it before queuing the Add_symbols task,
@@ -397,7 +411,7 @@ Read_symbols::do_read_symbols(Workqueue* workqueue)
if (this->member_ != NULL)
{
this->member_->sd_ = sd;
- this->member_->obj_ = obj;
+ this->member_->obj_ = elf_obj;
this->member_->arg_serial_ =
this->input_argument_->file().arg_serial();
return true;
@@ -412,7 +426,7 @@ Read_symbols::do_read_symbols(Workqueue* workqueue)
this->dirindex_,
this->mapfile_,
this->input_argument_,
- obj,
+ elf_obj,
NULL,
sd,
this->this_blocker_,