From patchwork Mon Jul 22 20:15:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Christopher X-Patchwork-Id: 260798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 5D6C62C00A7 for ; Tue, 23 Jul 2013 06:15:40 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=txo05+pb6IBnCtPiYOXOKEMGNIuC/W0UYBI1muTPsoQ /Utgikc/nMWy8T+lcJ4kUwCiPVa4kPY76mKFcSZB+szw/6NvSJl1gN6FDv6EXdGf 1qA5Kc6gFg1j7Wh69vAGoPOosMCH77vjd96s5IItZr65MwQ6fhvdT4/sS6dCNDGc = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=wZ0Tv2uM0auFvJPFCfw774rlNF4=; b=bRLE2b/PttHNSyloR UvXUOy0Zb3Jh0AeuDYjm2TqWqKDEo67KO2V7MJxHn56LzsLwqdTc3zfXCYXyA4Nd +R/urHcDO6zMq1sP72uvS8brAwuzXHYAFgLz7bPbJAD2AFtBYdEpGo+lDpvWRW0s 1MNjVsSbEzHHQWVI3XtNg7+DUs= Received: (qmail 14407 invoked by alias); 22 Jul 2013 20:15:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 14163 invoked by uid 89); 22 Jul 2013 20:15:25 -0000 X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RDNS_NONE, SPF_PASS autolearn=no version=3.3.1 Received: from Unknown (HELO mail-lb0-f172.google.com) (209.85.217.172) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 22 Jul 2013 20:15:24 +0000 Received: by mail-lb0-f172.google.com with SMTP id a16so43917lbj.3 for ; Mon, 22 Jul 2013 13:15:15 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.28.66 with SMTP id z2mr13214257lag.5.1374524115736; Mon, 22 Jul 2013 13:15:15 -0700 (PDT) Received: by 10.152.21.34 with HTTP; Mon, 22 Jul 2013 13:15:15 -0700 (PDT) Date: Mon, 22 Jul 2013 13:15:15 -0700 Message-ID: Subject: [PATCH] Use CHECKSUM_ macros and ULEB128 checksum for DIE tag From: Eric Christopher To: Cary Coutant Cc: gcc-patches@gcc.gnu.org X-Virus-Found: No 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 * 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]);