aboutsummaryrefslogtreecommitdiff
path: root/gold/icf.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/icf.cc')
-rw-r--r--gold/icf.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/gold/icf.cc b/gold/icf.cc
index 09cb1d4..a132875 100644
--- a/gold/icf.cc
+++ b/gold/icf.cc
@@ -182,6 +182,11 @@ preprocess_for_unique_sections(const std::vector<Section_id>& id_section,
section_size_type plen;
if (section_contents == NULL)
{
+ // 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);
const unsigned char* contents;
contents = secn.first->section_contents(secn.second,
&plen,
@@ -237,6 +242,11 @@ get_section_contents(bool first_iteration,
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);
@@ -363,6 +373,12 @@ 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.
@@ -682,6 +698,12 @@ Icf::find_identical_sections(const Input_objects* input_objects,
p != input_objects->relobj_end();
++p)
{
+ // 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, *p);
+
for (unsigned int i = 0;i < (*p)->shnum(); ++i)
{
const char* section_name = (*p)->section_name(i).c_str();