aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2006-09-21 22:13:18 +0000
committerIan Lance Taylor <iant@google.com>2006-09-21 22:13:18 +0000
commita2fb1b05e4af3fac54faac6c07a4717f2cb34aae (patch)
treecab19eb8c3abe76aee65d684dcceee884ed59c61 /gold/readsyms.cc
parent * remote-utils.c (try_rle): New function. (diff)
downloadbinutils-gdb-a2fb1b05e4af3fac54faac6c07a4717f2cb34aae.tar.gz
binutils-gdb-a2fb1b05e4af3fac54faac6c07a4717f2cb34aae.tar.bz2
binutils-gdb-a2fb1b05e4af3fac54faac6c07a4717f2cb34aae.zip
New drop, with first cut of section layout code.
Diffstat (limited to 'gold/readsyms.cc')
-rw-r--r--gold/readsyms.cc28
1 files changed, 23 insertions, 5 deletions
diff --git a/gold/readsyms.cc b/gold/readsyms.cc
index 1076e6c17ef..aa32e368e85 100644
--- a/gold/readsyms.cc
+++ b/gold/readsyms.cc
@@ -8,6 +8,7 @@
#include "options.h"
#include "dirsearch.h"
#include "readsyms.h"
+#include "object.h"
namespace gold
{
@@ -49,8 +50,6 @@ Read_symbols::locks(Workqueue*)
void
Read_symbols::run(Workqueue* workqueue)
{
- // We don't keep track of Input_file objects, so this is a memory
- // leak.
Input_file* input_file = new Input_file(this->input_);
input_file->open(this->options_, this->dirpath_);
@@ -71,7 +70,9 @@ Read_symbols::run(Workqueue* workqueue)
// This is an ELF object.
Object* obj = make_elf_object(this->input_.name(), input_file, 0,
p, bytes);
-
+
+ this->input_objects_->push_back(obj);
+
Read_symbols_data sd = obj->read_symbols();
workqueue->queue(new Add_symbols(this->symtab_, obj, sd,
this->this_blocker_,
@@ -99,20 +100,37 @@ Add_symbols::~Add_symbols()
// input file.
}
-// We are blocked by this_blocker_. We block next_blocker_.
+// We are blocked by this_blocker_. We block next_blocker_. We also
+// lock the file.
Task::Is_runnable_type
Add_symbols::is_runnable(Workqueue*)
{
if (this->this_blocker_ != NULL && this->this_blocker_->is_blocked())
return IS_BLOCKED;
+ if (this->object_->is_locked())
+ return IS_LOCKED;
return IS_RUNNABLE;
}
+class Add_symbols::Add_symbols_locker : public Task_locker
+{
+ public:
+ Add_symbols_locker(Task_token& token, Workqueue* workqueue,
+ Object* object)
+ : blocker_(token, workqueue), objlock_(*object)
+ { }
+
+ private:
+ Task_locker_block blocker_;
+ Task_locker_obj<Object> objlock_;
+};
+
Task_locker*
Add_symbols::locks(Workqueue* workqueue)
{
- return new Task_locker_block(*this->next_blocker_, workqueue);
+ return new Add_symbols_locker(*this->next_blocker_, workqueue,
+ this->object_);
}
void