2011-01-25 Doug Kwan <dougkwan@google.com>
authorDoug Kwan <dougkwan@google.com>
Tue, 25 Jan 2011 17:14:59 +0000 (17:14 +0000)
committerDoug Kwan <dougkwan@google.com>
Tue, 25 Jan 2011 17:14:59 +0000 (17:14 +0000)
* gold/icf.cc (get_section_contents): Always lock section's object.

gold/ChangeLog
gold/icf.cc

index 0c14f7c35b964e790f6f3a3e6939bde9f3a0ba60..6bf49b49108deccdffb570d1980a9f56bbf362b4 100644 (file)
@@ -1,3 +1,7 @@
+2011-01-25  Doug Kwan  <dougkwan@google.com>
+
+       * gold/icf.cc (get_section_contents): Always lock section's object.
+
 2011-01-24  Ian Lance Taylor  <iant@google.com>
 
        * options.h (class General_options): Accept
index 5ec53ffe6c001bd074e2df9e1e4177958bab92b5..13e8374b504e9fdb9b01ab3e1a7c53f3ee4fdb2c 100644 (file)
@@ -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.
This page took 0.033768 seconds and 4 git commands to generate.