]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarf_output::copier fix for circular refs
authorRoland McGrath <roland@redhat.com>
Fri, 28 Aug 2009 00:53:30 +0000 (17:53 -0700)
committerRoland McGrath <roland@redhat.com>
Fri, 28 Aug 2009 00:53:30 +0000 (17:53 -0700)
libdw/ChangeLog
libdw/c++/dwarf_output

index 308fda3efc68c26e9e94c14e48b9d8f22da1cb62..808703f81042ee6b749ef626c02557b49b6fd9b3 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-27  Roland McGrath  <roland@redhat.com>
+
+       * c++/dwarf_output (dwarf_output::copier::seen::promote_pending):
+       Notice circularity inside resolve_refs.
+
 2009-08-25  Roland McGrath  <roland@redhat.com>
 
        * c++/dwarf_tracker: Soup up circular reference handling to handle
index ddc6dab79f655f134732169cde1b464bc907748a..52a16e575a8f696842e8019c71cca427e49e570e 100644 (file)
@@ -1552,6 +1552,7 @@ namespace elfutils
        {
          _m_die->dump (true) << " promoting " << what << " "
                              << (void *) final << "...\n";
+         assert (_m_die->_m_resolving == NULL);
          _m_die->_m_resolving = final;
        }
        inline ~entry_promoter ()
@@ -1572,6 +1573,22 @@ namespace elfutils
                    << final << "/" << (_m_final != NULL)
                    << " nrefs " << _m_patch.size () << "\n";
 
+       if (_m_resolving != NULL)
+         {
+           /* We are inside a resolve_refs call already promoting us.
+              Prune the circularity.  */
+           if (final)
+             *_m_resolving = true;
+           else
+             {
+               assert (was_dangling);
+               ++c->_m_defined;
+               resolve_circular_refs (c, this);
+             }
+           dump (false, true) << " pruned circularity!\n";
+           return;
+         }
+
        if (!final)
          {
            // We are now pending but not dangling.  Adjust bookkeeping.