(From Rafael Espindola)
* archive.cc (Archive::include_member): Update calls to add_symbols. * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add the Layout argument. * dynobj.h (do_add_symbols): Add the Layout argument. * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the Layout argument. * object.h (Object::add_symbols): Add the Layout argument. (Object::do_add_symbols): Add the Layout argument. (Sized_relobj::do_add_symbols): Add the Layout argument. * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols): Unify the two versions. (Add_plugin_symbols): Remove. * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove. (Sized_pluginobj::do_add_symbols): Unify the two versions. (Add_plugin_symbols): Remove. * readsyms.cc (Read_symbols::do_read_symbols): Update call to Add_symbols. Use Add_symbols instead of Add_plugin_symbols. (Add_symbols::run): Make it work with Pulginobj.
This commit is contained in:
parent
7065b901d5
commit
f488e4b0e9
@ -1,3 +1,24 @@
|
||||
2009-02-13 Rafael Avila de Espindola <espindola@google.com>
|
||||
|
||||
* archive.cc (Archive::include_member): Update calls to add_symbols.
|
||||
* dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
|
||||
the Layout argument.
|
||||
* dynobj.h (do_add_symbols): Add the Layout argument.
|
||||
* object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
|
||||
Layout argument.
|
||||
* object.h (Object::add_symbols): Add the Layout argument.
|
||||
(Object::do_add_symbols): Add the Layout argument.
|
||||
(Sized_relobj::do_add_symbols): Add the Layout argument.
|
||||
* plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
|
||||
Unify the two versions.
|
||||
(Add_plugin_symbols): Remove.
|
||||
* plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
|
||||
(Sized_pluginobj::do_add_symbols): Unify the two versions.
|
||||
(Add_plugin_symbols): Remove.
|
||||
* readsyms.cc (Read_symbols::do_read_symbols): Update call to
|
||||
Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
|
||||
(Add_symbols::run): Make it work with Pulginobj.
|
||||
|
||||
2009-02-06 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* object.cc (Sized_relobj::do_layout): Make info message start
|
||||
|
@ -759,7 +759,7 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
|
||||
if (input_objects->add_object(obj))
|
||||
{
|
||||
obj->layout(symtab, layout, sd);
|
||||
obj->add_symbols(symtab, sd);
|
||||
obj->add_symbols(symtab, sd, layout);
|
||||
}
|
||||
delete sd;
|
||||
return;
|
||||
@ -775,7 +775,7 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
|
||||
Pluginobj* pluginobj = obj->pluginobj();
|
||||
if (pluginobj != NULL)
|
||||
{
|
||||
pluginobj->add_symbols(symtab, layout);
|
||||
pluginobj->add_symbols(symtab, NULL, layout);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -784,7 +784,7 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
|
||||
Read_symbols_data sd;
|
||||
obj->read_symbols(&sd);
|
||||
obj->layout(symtab, layout, &sd);
|
||||
obj->add_symbols(symtab, &sd);
|
||||
obj->add_symbols(symtab, &sd, layout);
|
||||
|
||||
// If this is an external member of a thin archive, unlock the file
|
||||
// for the next task.
|
||||
|
@ -655,7 +655,8 @@ Sized_dynobj<size, big_endian>::make_version_map(
|
||||
template<int size, bool big_endian>
|
||||
void
|
||||
Sized_dynobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
|
||||
Read_symbols_data* sd)
|
||||
Read_symbols_data* sd,
|
||||
Layout*)
|
||||
{
|
||||
if (sd->symbols == NULL)
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ class Sized_dynobj : public Dynobj
|
||||
|
||||
// Add the symbols to the symbol table.
|
||||
void
|
||||
do_add_symbols(Symbol_table*, Read_symbols_data*);
|
||||
do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*);
|
||||
|
||||
// Get the size of a section.
|
||||
uint64_t
|
||||
|
@ -1349,7 +1349,8 @@ Sized_relobj<size, big_endian>::do_layout_deferred_sections(Layout* layout)
|
||||
template<int size, bool big_endian>
|
||||
void
|
||||
Sized_relobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
|
||||
Read_symbols_data* sd)
|
||||
Read_symbols_data* sd,
|
||||
Layout*)
|
||||
{
|
||||
if (sd->symbols == NULL)
|
||||
{
|
||||
|
@ -350,8 +350,8 @@ class Object
|
||||
|
||||
// Add symbol information to the global symbol table.
|
||||
void
|
||||
add_symbols(Symbol_table* symtab, Read_symbols_data* sd)
|
||||
{ this->do_add_symbols(symtab, sd); }
|
||||
add_symbols(Symbol_table* symtab, Read_symbols_data* sd, Layout *layout)
|
||||
{ this->do_add_symbols(symtab, sd, layout); }
|
||||
|
||||
// Functions and types for the elfcpp::Elf_file interface. This
|
||||
// permit us to use Object as the File template parameter for
|
||||
@ -462,7 +462,7 @@ class Object
|
||||
// Add symbol information to the global symbol table--implemented by
|
||||
// child class.
|
||||
virtual void
|
||||
do_add_symbols(Symbol_table*, Read_symbols_data*) = 0;
|
||||
do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*) = 0;
|
||||
|
||||
// Return the location of the contents of a section. Implemented by
|
||||
// child class.
|
||||
@ -1446,7 +1446,7 @@ class Sized_relobj : public Relobj
|
||||
|
||||
// Add the symbols to the symbol table.
|
||||
void
|
||||
do_add_symbols(Symbol_table*, Read_symbols_data*);
|
||||
do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*);
|
||||
|
||||
// Read the relocs.
|
||||
void
|
||||
|
@ -544,17 +544,10 @@ Sized_pluginobj<size, big_endian>::do_layout(Symbol_table*, Layout*,
|
||||
|
||||
// Add the symbols to the symbol table.
|
||||
|
||||
template<int size, bool big_endian>
|
||||
void
|
||||
Sized_pluginobj<size, big_endian>::do_add_symbols(Symbol_table*,
|
||||
Read_symbols_data*)
|
||||
{
|
||||
gold_unreachable();
|
||||
}
|
||||
|
||||
template<int size, bool big_endian>
|
||||
void
|
||||
Sized_pluginobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
|
||||
Read_symbols_data*,
|
||||
Layout* layout)
|
||||
{
|
||||
const int sym_size = elfcpp::Elf_sizes<size>::sym_size;
|
||||
@ -756,44 +749,6 @@ Sized_pluginobj<size, big_endian>::do_get_global_symbol_counts(const Symbol_tabl
|
||||
gold_unreachable();
|
||||
}
|
||||
|
||||
// Class Add_plugin_symbols.
|
||||
|
||||
Add_plugin_symbols::~Add_plugin_symbols()
|
||||
{
|
||||
if (this->this_blocker_ != NULL)
|
||||
delete this->this_blocker_;
|
||||
// next_blocker_ is deleted by the task associated with the next
|
||||
// input file.
|
||||
}
|
||||
|
||||
// We are blocked by this_blocker_. We block next_blocker_. We also
|
||||
// lock the file.
|
||||
|
||||
Task_token*
|
||||
Add_plugin_symbols::is_runnable()
|
||||
{
|
||||
if (this->this_blocker_ != NULL && this->this_blocker_->is_blocked())
|
||||
return this->this_blocker_;
|
||||
if (this->obj_->is_locked())
|
||||
return this->obj_->token();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
Add_plugin_symbols::locks(Task_locker* tl)
|
||||
{
|
||||
tl->add(this, this->next_blocker_);
|
||||
tl->add(this, this->obj_->token());
|
||||
}
|
||||
|
||||
// Add the symbols in the object to the symbol table.
|
||||
|
||||
void
|
||||
Add_plugin_symbols::run(Workqueue*)
|
||||
{
|
||||
this->obj_->add_symbols(this->symtab_, this->layout_);
|
||||
}
|
||||
|
||||
// Class Plugin_finish. This task runs after all replacement files have
|
||||
// been added. It calls each plugin's cleanup handler.
|
||||
|
||||
|
@ -294,11 +294,6 @@ class Pluginobj : public Object
|
||||
ld_plugin_status
|
||||
get_symbol_resolution_info(int nsyms, ld_plugin_symbol* syms) const;
|
||||
|
||||
// Add symbol information to the global symbol table.
|
||||
void
|
||||
add_symbols(Symbol_table* symtab, Layout* layout)
|
||||
{ this->do_add_symbols(symtab, layout); }
|
||||
|
||||
// Store the incoming symbols from the plugin for later processing.
|
||||
void
|
||||
store_incoming_symbols(int nsyms, const struct ld_plugin_symbol* syms)
|
||||
@ -333,11 +328,6 @@ class Pluginobj : public Object
|
||||
do_pluginobj()
|
||||
{ return this; }
|
||||
|
||||
// Add symbol information to the global symbol table--implemented by
|
||||
// child class.
|
||||
virtual void
|
||||
do_add_symbols(Symbol_table*, Layout*) = 0;
|
||||
|
||||
// The number of symbols provided by the plugin.
|
||||
int nsyms_;
|
||||
|
||||
@ -375,10 +365,7 @@ class Sized_pluginobj : public Pluginobj
|
||||
|
||||
// Add the symbols to the symbol table.
|
||||
void
|
||||
do_add_symbols(Symbol_table*, Read_symbols_data*);
|
||||
|
||||
void
|
||||
do_add_symbols(Symbol_table*, Layout*);
|
||||
do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*);
|
||||
|
||||
// Get the size of a section.
|
||||
uint64_t
|
||||
@ -433,50 +420,6 @@ class Sized_pluginobj : public Pluginobj
|
||||
private:
|
||||
};
|
||||
|
||||
// This Task handles adding the symbols to the symbol table. These
|
||||
// tasks must be run in the same order as the arguments appear on the
|
||||
// command line.
|
||||
|
||||
class Add_plugin_symbols : public Task
|
||||
{
|
||||
public:
|
||||
// THIS_BLOCKER is used to prevent this task from running before the
|
||||
// one for the previous input file. NEXT_BLOCKER is used to prevent
|
||||
// the next task from running.
|
||||
Add_plugin_symbols(Symbol_table* symtab,
|
||||
Layout* layout,
|
||||
Pluginobj* obj,
|
||||
Task_token* this_blocker,
|
||||
Task_token* next_blocker)
|
||||
: symtab_(symtab), layout_(layout), obj_(obj),
|
||||
this_blocker_(this_blocker), next_blocker_(next_blocker)
|
||||
{ }
|
||||
|
||||
~Add_plugin_symbols();
|
||||
|
||||
// The standard Task methods.
|
||||
|
||||
Task_token*
|
||||
is_runnable();
|
||||
|
||||
void
|
||||
locks(Task_locker*);
|
||||
|
||||
void
|
||||
run(Workqueue*);
|
||||
|
||||
std::string
|
||||
get_name() const
|
||||
{ return "Add_plugin_symbols " + this->obj_->name(); }
|
||||
|
||||
private:
|
||||
Symbol_table* symtab_;
|
||||
Layout* layout_;
|
||||
Pluginobj* obj_;
|
||||
Task_token* this_blocker_;
|
||||
Task_token* next_blocker_;
|
||||
};
|
||||
|
||||
// This Task handles handles the "all symbols read" event hook.
|
||||
// The plugin may add additional input files at this time, which must
|
||||
// be queued for reading.
|
||||
|
@ -200,11 +200,12 @@ Read_symbols::do_read_symbols(Workqueue* workqueue)
|
||||
// We are done with the file at this point, so unlock it.
|
||||
obj->unlock(this);
|
||||
|
||||
workqueue->queue_next(new Add_plugin_symbols(this->symtab_,
|
||||
this->layout_,
|
||||
obj,
|
||||
this->this_blocker_,
|
||||
this->next_blocker_));
|
||||
workqueue->queue_next(new Add_symbols(this->input_objects_,
|
||||
this->symtab_,
|
||||
this->layout_,
|
||||
obj, NULL,
|
||||
this->this_blocker_,
|
||||
this->next_blocker_));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -379,6 +380,13 @@ Add_symbols::locks(Task_locker* tl)
|
||||
void
|
||||
Add_symbols::run(Workqueue*)
|
||||
{
|
||||
Pluginobj* pluginobj = this->object_->pluginobj();
|
||||
if (pluginobj != NULL)
|
||||
{
|
||||
this->object_->add_symbols(this->symtab_, this->sd_, this->layout_);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this->input_objects_->add_object(this->object_))
|
||||
{
|
||||
// FIXME: We need to close the descriptor here.
|
||||
@ -387,7 +395,7 @@ Add_symbols::run(Workqueue*)
|
||||
else
|
||||
{
|
||||
this->object_->layout(this->symtab_, this->layout_, this->sd_);
|
||||
this->object_->add_symbols(this->symtab_, this->sd_);
|
||||
this->object_->add_symbols(this->symtab_, this->sd_, this->layout_);
|
||||
this->object_->release();
|
||||
}
|
||||
delete this->sd_;
|
||||
|
Loading…
Reference in New Issue
Block a user