From patchwork Tue Aug 13 23:41:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cary Coutant X-Patchwork-Id: 266940 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 0EA0F2C0167 for ; Wed, 14 Aug 2013 09:41:14 +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:date :to:subject:mime-version:content-type:content-transfer-encoding :message-id:from; q=dns; s=default; b=nMjMtTS4dnyh56s1tYJgxwi1AT HZyjLO74KLwk33+C18Nch1od/LtX0spwlHCMsO3WrxD3ZDSzMCgQ40drlYMphidG rR4TtTcM29hqb8GJlKlPwnz7P0pABvWhbSAHLuCooWSeBL0E7DhcaTOmkvrRC0AE 704ui2jLFPOvxri6Y= 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:date :to:subject:mime-version:content-type:content-transfer-encoding :message-id:from; s=default; bh=V4qjFZo26m+o/SNVXF1dLtZABqk=; b= aHJg251w5EQ0nrWsK+axuij9Nj+lvUdV6EYbIZDcaic+zdRmynLYCh2hxja9dZ1e Ek8KB7aXERedN3syj4+Dp5X3FfuHRzT+CwbYNK8wIgpcrOwrqbbcnE46IGbyHnfe j89qwxY5pvubyD5+qSDrnxcwhW4T7GB30DLbCa4Hl9M= Received: (qmail 7479 invoked by alias); 13 Aug 2013 23:41:07 -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 7460 invoked by uid 89); 13 Aug 2013 23:41:07 -0000 X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS, T_FRT_ADULT2 autolearn=ham version=3.3.2 Received: from mail-gh0-f201.google.com (HELO mail-gh0-f201.google.com) (209.85.160.201) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 13 Aug 2013 23:41:06 +0000 Received: by mail-gh0-f201.google.com with SMTP id r14so181118ghr.0 for ; Tue, 13 Aug 2013 16:41:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:date:to:subject:user-agent:mime-version :content-type:content-transfer-encoding:message-id:from; bh=3tozu1wtn17MFAP6k8mCy2my/s3Cyw1pQoztMgQrskI=; b=IM62SAUf6dCSVXubhBjrXZ2kKfFgRbyrBvKsQOh6lXgxrBClI2OjJAhJTefc0cElp3 Y7aiTqsNn8HkynHMxCY40G41igy79ZVmLbrN6PwoqEflafrG8nVvLCY5pdg/fj/NDGa5 Yd6499aiV0pwBB5NpIhZDZi80PgchP80cWQhIac41bVycwNpIqY5iCcGF6MBV9A440s5 GsHY6aKjwx96p7OMb9orDOx8IBuDq5nh7clQbcyLJ9uURafD42C/cy3aheI06E11otbJ /F3N0LVGnJgVRkm1sh4uQAHLmPXWByVZu0okeNm63LhmZZGnH/zZQt9mxRpm5UYWh5QM DTzg== X-Gm-Message-State: ALoCoQn+ip551rPpE83uT0Lf2bqlv4I0PB96EpfKptgLUJ0WNxNu/8uz8VhGYISpgNjHEZqbqFOt80VUiU+/eE9YmW27tGWjvTL41mHYQm98PrDTyf++eFV1yrB8nouvfJq+BAHpdcjnc3h+HV6yF8XqOZYiY2LkDl4HobyCOC34GiG3RF73mr95nvwrN5II6kAVSoT3Bpaup1Tqjwofn536HCPtMmeZMiUdkATswwt0EeJfsOtHd9k= X-Received: by 10.224.13.136 with SMTP id c8mr7087203qaa.0.1376437264373; Tue, 13 Aug 2013 16:41:04 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id r1si4916933qch.3.2013.08.13.16.41.04 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Tue, 13 Aug 2013 16:41:04 -0700 (PDT) Received: from ccoutant.mtv.corp.google.com (ccoutant.mtv.corp.google.com [172.17.128.119]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 2DEDC31C1C7 for ; Tue, 13 Aug 2013 16:41:04 -0700 (PDT) Received: by ccoutant.mtv.corp.google.com (Postfix, from userid 62097) id AF3B0160A98; Tue, 13 Aug 2013 16:41:03 -0700 (PDT) Date: Tue, 13 Aug 2013 16:41:03 -0700 To: gcc-patches@gcc.gnu.org Subject: [patch] Fix non-determinism problem with DWARF output. User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Message-Id: <20130813234103.AF3B0160A98@ccoutant.mtv.corp.google.com> From: ccoutant@google.com (Cary Coutant) This patch fixes a problem with -fdebug-types-section and with -gsplit-dwarf where the hash computation for the type signature and for the DW_AT_dwo_id attribute may produce results that differ from run to run. For dw_val_class_vec values (e.g., the const value of a small struct), both hash computations use the value of a pointer instead of the actual data. Bootstrapped, tested, and committed to trunk. -cary 2013-08-13 Cary Coutant gcc/ * dwarf2out.c (CHECKSUM_BLOCK): New macro. (attr_checksum): Hash vector contents instead of pointer. (attr_checksum_ordered): Likewise. Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 201711) +++ dwarf2out.c (working copy) @@ -5432,6 +5432,7 @@ pop_compile_unit (dw_die_ref old_unit) } #define CHECKSUM(FOO) md5_process_bytes (&(FOO), sizeof (FOO), ctx) +#define CHECKSUM_BLOCK(FOO, SIZE) md5_process_bytes ((FOO), (SIZE), ctx) #define CHECKSUM_STRING(FOO) md5_process_bytes ((FOO), strlen (FOO), ctx) /* Calculate the checksum of a location expression. */ @@ -5475,7 +5476,9 @@ attr_checksum (dw_attr_ref at, struct md CHECKSUM (at->dw_attr_val.v.val_double); break; case dw_val_class_vec: - CHECKSUM (at->dw_attr_val.v.val_vec); + CHECKSUM_BLOCK (at->dw_attr_val.v.val_vec.array, + (at->dw_attr_val.v.val_vec.length + * at->dw_attr_val.v.val_vec.elt_size)); break; case dw_val_class_flag: CHECKSUM (at->dw_attr_val.v.val_flag); @@ -5550,10 +5553,12 @@ die_checksum (dw_die_ref die, struct md5 } #undef CHECKSUM +#undef CHECKSUM_BLOCK #undef CHECKSUM_STRING /* For DWARF-4 types, include the trailing NULL when checksumming strings. */ #define CHECKSUM(FOO) md5_process_bytes (&(FOO), sizeof (FOO), ctx) +#define CHECKSUM_BLOCK(FOO, SIZE) md5_process_bytes ((FOO), (SIZE), ctx) #define CHECKSUM_STRING(FOO) md5_process_bytes ((FOO), strlen (FOO) + 1, ctx) #define CHECKSUM_SLEB128(FOO) checksum_sleb128 ((FOO), ctx) #define CHECKSUM_ULEB128(FOO) checksum_uleb128 ((FOO), ctx) @@ -5749,8 +5754,11 @@ attr_checksum_ordered (enum dwarf_tag ta case dw_val_class_vec: CHECKSUM_ULEB128 (DW_FORM_block); - CHECKSUM_ULEB128 (sizeof (at->dw_attr_val.v.val_vec)); - CHECKSUM (at->dw_attr_val.v.val_vec); + CHECKSUM_ULEB128 (at->dw_attr_val.v.val_vec.length + * at->dw_attr_val.v.val_vec.elt_size); + CHECKSUM_BLOCK (at->dw_attr_val.v.val_vec.array, + (at->dw_attr_val.v.val_vec.length + * at->dw_attr_val.v.val_vec.elt_size)); break; case dw_val_class_flag: