This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold/dwp patch] Fix internal error when adding a duplicate CU

This patch fixes a bug where adding a duplicate CU to the index
results in an incorrect count of used slots in the hash table. That
shouldn't happen, so I added a warning to detect the case, and an
assert in enter_set() to make sure the slot is empty.

OK to commit?


commit aa4d3bf9722f18695f06387fa5e5b50ca98d60ee
Author: Cary Coutant <>
Date:   Fri Dec 14 14:59:56 2012 -0800

    Fix internal error when adding a duplicate CU.

    	* (Dwp_output_file::add_cu_set): Check for duplicate CUs.
    	(Dwp_output_file::Dwp_index::enter_set): Add assert.

diff --git a/gold/ b/gold/
index 3f7d7bb..a81839c 100644
--- a/gold/
+++ b/gold/
@@ -1532,8 +1532,11 @@ Dwp_output_file::add_cu_set(uint64_t dwo_id,
 			  debug_loc, debug_str_offsets, debug_macinfo,
 			  debug_macro };
   unsigned int slot;
-  this->cu_index_.find_or_add(dwo_id, &slot);
-  this->cu_index_.enter_set(slot, cu_set);
+  if (!this->cu_index_.find_or_add(dwo_id, &slot))
+    this->cu_index_.enter_set(slot, cu_set);
+  else
+    gold_warning(_("%s: duplicate entry for CU (dwo_id 0x%llx)"),
+		 this->name_, (unsigned long long)dwo_id);

 // Lookup a type signature and return TRUE if we have already seen it.
@@ -1617,6 +1620,7 @@ Dwp_output_file::Dwp_index::enter_set(unsigned int slot,

   // Enter the signature and pool index into the hash table.
+  gold_assert(this->hash_table_[slot] == 0);
   this->hash_table_[slot] = set.signature;
   this->index_table_[slot] = pool_index;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]