From a5dc7f88de18ed816eb57be1ede6083528406893 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Mon, 10 Jun 2013 23:48:41 +0000 Subject: dwarf2out.c (hash_external_ref): Use die_symbol or signature for hash so that hash table traversal order is... 2013-06-10 Cary Coutant gcc/ * dwarf2out.c (hash_external_ref): Use die_symbol or signature for hash so that hash table traversal order is deterministic. From-SVN: r199927 --- gcc/dwarf2out.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'gcc/dwarf2out.c') diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b615b18..f42ad66 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -7388,7 +7388,22 @@ struct external_ref_hasher : typed_free_remove 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 -- cgit v1.1