// readsyms.cc -- read input file symbols for gold
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2006-2020 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
Read_symbols::run(Workqueue* workqueue)
{
// If we didn't queue a new task, then we need to explicitly unblock
- // the token.
- if (!this->do_read_symbols(workqueue))
+ // the token. If the object is a member of a lib group, however,
+ // the token was already added to the list of locks for the task,
+ // and it will be unblocked automatically at the end of the task.
+ if (!this->do_read_symbols(workqueue) && this->member_ == NULL)
workqueue->queue_soon(new Unblock_token(this->this_blocker_,
this->next_blocker_));
}
}
}
+ 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.
{
// 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)
{
}
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,
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;
this->dirindex_,
this->mapfile_,
this->input_argument_,
- obj,
+ elf_obj,
NULL,
sd,
this->this_blocker_,
if (!this->input_objects_->add_object(this->object_))
{
+ this->object_->discard_decompressed_sections();
gold_assert(this->sd_ != NULL);
delete this->sd_;
this->sd_ = NULL;
}
this->object_->layout(this->symtab_, this->layout_, this->sd_);
this->object_->add_symbols(this->symtab_, this->sd_, this->layout_);
+ this->object_->discard_decompressed_sections();
delete this->sd_;
this->sd_ = NULL;
this->object_->release();
Task_token*
Read_member::is_runnable()
{
+ if (this->this_blocker_ != NULL && this->this_blocker_->is_blocked())
+ return this->this_blocker_;
return NULL;
}