summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorccoutant <ccoutant@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-10 23:48:41 +0000
committerccoutant <ccoutant@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-10 23:48:41 +0000
commitdaccd6b36c8f61e910eee03cb7fda952466d6033 (patch)
tree79e4639c3dc0000442e3e6ed06a02143a5256b8b
parent62aab3f32fad9b01ee0ead73ed58817af3ac5046 (diff)
downloadgcc-daccd6b36c8f61e910eee03cb7fda952466d6033.tar.gz
2013-06-10 Cary Coutant <ccoutant@google.com>
gcc/ * dwarf2out.c (hash_external_ref): Use die_symbol or signature for hash so that hash table traversal order is deterministic. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199927 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/dwarf2out.c17
2 files changed, 21 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 77bd5e6c200..703428af0cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-10 Cary Coutant <ccoutant@google.com>
+
+ * dwarf2out.c (hash_external_ref): Use die_symbol or signature
+ for hash so that hash table traversal order is deterministic.
+
2013-06-10 Michael Meissner <meissner@linux.vnet.ibm.com>
Pat Haugen <pthaugen@us.ibm.com>
Peter Bergner <bergner@vnet.ibm.com>
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index b615b181a3b..f42ad66353b 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -7388,7 +7388,22 @@ struct external_ref_hasher : typed_free_remove <external_ref>
inline hashval_t
external_ref_hasher::hash (const value_type *r)
{
- return htab_hash_pointer (r->type);
+ dw_die_ref die = r->type;
+ hashval_t h = 0;
+
+ /* We can't use the address of the DIE for hashing, because
+ that will make the order of the stub DIEs non-deterministic. */
+ if (! die->comdat_type_p)
+ /* We have a symbol; use it to compute a hash. */
+ h = htab_hash_string (die->die_id.die_symbol);
+ else
+ {
+ /* We have a type signature; use a subset of the bits as the hash.
+ The 8-byte signature is at least as large as hashval_t. */
+ comdat_type_node_ref type_node = die->die_id.die_type_node;
+ memcpy (&h, type_node->signature, sizeof (h));
+ }
+ return h;
}
inline bool