Hi Cary,

This patch changes the ODR checker to use the CHECKSUM_ macros and
instead of depending on size of int to use the ULEB128 of the tag
(similar to the deep hash) to compute the values.

Thoughts?

-eric

2013-07-22  Eric Christopher  <echri...@gmail.com>

        * dwarf2out.c (die_odr_checksum): New function to use
        CHECKSUM_ macros and ULEB128 for DIE tag.
        (generate_type_signature): Use.
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     (revision 198904)
+++ gcc/dwarf2out.c     (working copy)
@@ -6097,6 +6097,13 @@
   CHECKSUM_ULEB128 (0);
 }
 
+static void
+die_odr_checksum (dw_die_ref die, md5_ctx *ctx)
+{
+  CHECKSUM_ULEB128(die->die_tag);
+  CHECKSUM_STRING(get_AT_string(die, DW_AT_name));
+}
+
 #undef CHECKSUM
 #undef CHECKSUM_STRING
 #undef CHECKSUM_ATTR
@@ -6128,7 +6135,6 @@
   /* First, compute a signature for just the type name (and its surrounding
      context, if any.  This is stored in the type unit DIE for link-time
      ODR (one-definition rule) checking.  */
-
   if (is_cxx() && name != NULL)
     {
       md5_init_ctx (&ctx);
@@ -6137,8 +6143,8 @@
       if (parent != NULL)
         checksum_die_context (parent, &ctx);
 
-      md5_process_bytes (&die->die_tag, sizeof (die->die_tag), &ctx);
-      md5_process_bytes (name, strlen (name) + 1, &ctx);
+      /* Checksum the current DIE. */
+      die_odr_checksum(die, &ctx);
       md5_finish_ctx (&ctx, checksum);
 
       add_AT_data8 (type_node->root_die, DW_AT_GNU_odr_signature, 
&checksum[8]);

Reply via email to