aboutsummaryrefslogtreecommitdiff
path: root/gold/icf.cc
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2011-01-25 17:14:59 +0000
committerDoug Kwan <dougkwan@google.com>2011-01-25 17:14:59 +0000
commit880473a6be1103b2e4cc2b2d67d2ee40e9b0883f (patch)
tree43d234484ae4e9b802bb2bdc58e3dd029a0d8b4f /gold/icf.cc
parent2062226976cdf020016442cc64de30c984b407d3 (diff)
downloadgdb-880473a6be1103b2e4cc2b2d67d2ee40e9b0883f.zip
gdb-880473a6be1103b2e4cc2b2d67d2ee40e9b0883f.tar.gz
gdb-880473a6be1103b2e4cc2b2d67d2ee40e9b0883f.tar.bz2
2011-01-25 Doug Kwan <dougkwan@google.com>
* gold/icf.cc (get_section_contents): Always lock section's object.
Diffstat (limited to 'gold/icf.cc')
-rw-r--r--gold/icf.cc24
1 files changed, 7 insertions, 17 deletions
diff --git a/gold/icf.cc b/gold/icf.cc
index 5ec53ff..13e8374 100644
--- a/gold/icf.cc
+++ b/gold/icf.cc
@@ -237,20 +237,16 @@ get_section_contents(bool first_iteration,
const std::vector<unsigned int>& kept_section_id,
std::vector<std::string>* section_contents)
{
+ // Lock the object so we can read from it. This is only called
+ // single-threaded from queue_middle_tasks, so it is OK to lock.
+ // Unfortunately we have no way to pass in a Task token.
+ const Task* dummy_task = reinterpret_cast<const Task*>(-1);
+ Task_lock_obj<Object> tl(dummy_task, secn.first);
+
section_size_type plen;
const unsigned char* contents = NULL;
-
if (first_iteration)
- {
- // Lock the object so we can read from it. This is only called
- // single-threaded from queue_middle_tasks, so it is OK to lock.
- // Unfortunately we have no way to pass in a Task token.
- const Task* dummy_task = reinterpret_cast<const Task*>(-1);
- Task_lock_obj<Object> tl(dummy_task, secn.first);
- contents = secn.first->section_contents(secn.second,
- &plen,
- false);
- }
+ contents = secn.first->section_contents(secn.second, &plen, false);
// The buffer to hold all the contents including relocs. A checksum
// is then computed on this buffer.
@@ -373,12 +369,6 @@ get_section_contents(bool first_iteration,
if (!first_iteration)
continue;
- // Lock the object so we can read from it. This is only called
- // single-threaded from queue_middle_tasks, so it is OK to lock.
- // Unfortunately we have no way to pass in a Task token.
- const Task* dummy_task = reinterpret_cast<const Task*>(-1);
- Task_lock_obj<Object> tl(dummy_task, it_v->first);
-
uint64_t secn_flags = (it_v->first)->section_flags(it_v->second);
// This reloc points to a merge section. Hash the
// contents of this section.