From patchwork Mon Sep 24 21:42:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Xu X-Patchwork-Id: 186580 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]) by ozlabs.org (Postfix) with SMTP id 89F272C0087 for ; Tue, 25 Sep 2012 07:42:53 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1349127773; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=3nCXgSc 8Inwg7D5fDioFcQwk9QE=; b=DyrlYmEqOZ2MmKcX2IndXpaMFyTBUFaYyTxpMaj WHg6rV8qNhn0s5gWopJYvprdG8ekf5rMvN41Y8pnr7Sve1Gs6AkjDWa05D4qaXUw 7k3IsWr/kqGi8fRDnCx5b1d3Qpn3YNrQC2HwkG6IbMGZNUaeVzr9HOqQIN5vh3VS 0M4w= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=CbkDIHL6CQIlYz0aGvYhR+5s+y7cQ1sbnVZLUKSS1NE+jBI5Cb8bXG9Xt482HZ AiJVkIMlXLEvxJ6OfRN7ELZIOiPwWyKlzGzOYDalFvG6/bxtmfNTKMme4MI1XDZH O+Jb4YmoSHzmBjpodGndp7bH6B7zSqSr4BTmAriHBWdFc=; Received: (qmail 12513 invoked by alias); 24 Sep 2012 21:42:50 -0000 Received: (qmail 12503 invoked by uid 22791); 24 Sep 2012 21:42:49 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_HK, URIBL_DBL_REDIR X-Spam-Check-By: sourceware.org Received: from mail-ee0-f73.google.com (HELO mail-ee0-f73.google.com) (74.125.83.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 Sep 2012 21:42:35 +0000 Received: by eekc4 with SMTP id c4so64910eek.2 for ; Mon, 24 Sep 2012 14:42:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=SwlqaCf8srnlb98PCbyQSbxZgAhxNeIr2OPqEyFAtvs=; b=T0hueUFvnTRqbWN7/loSynAEZk797r025HtpTPldF7T1mTfUI9W2YbHKzAOyVLd2Jb inHMD+53bejIk2u0MBVU59baYfWTB9LlAAOsTW5cl50vmnGA+N6TFpSdkDo6Z+B1jFTx sZfhvndr2Hz7Kn+YuH9pwbCdi8G4KIyt6a+LVCIukCDdKqXg/2o7+gdUMgsuV7z4BD0i dzwccFIaE70pUWPRFqbmeKWkdVBJQ8sNtDvGGzAEqwWR+Ni33FJxeerOc3s6FqAzwy0x w9A4U3CEKoXf8qX3V6QHuDvhvgZy5I1opYDVGNdSLOFpUeFOFf/1jXENGOnqEA32XCxj Y2LQ== Received: by 10.180.94.98 with SMTP id db2mr2383389wib.2.1348522954020; Mon, 24 Sep 2012 14:42:34 -0700 (PDT) Received: by 10.180.94.98 with SMTP id db2mr2383386wib.2.1348522953972; Mon, 24 Sep 2012 14:42:33 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id fb20si808181wid.3.2012.09.24.14.42.33 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 24 Sep 2012 14:42:33 -0700 (PDT) Received: from rong2.dls.corp.google.com (rong2.dls.corp.google.com [172.25.4.203]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id 8E8F95C007C; Mon, 24 Sep 2012 14:42:33 -0700 (PDT) Received: by rong2.dls.corp.google.com (Postfix, from userid 104659) id B0F1B55CAC; Mon, 24 Sep 2012 14:42:32 -0700 (PDT) To: reply@codereview.appspotmail.com, davidxl@google.com, gcc-patches@gcc.gnu.org Subject: [google 4.7] fix line number checksum mismatch in lipo-use (issue6566044) Message-Id: <20120924214232.B0F1B55CAC@rong2.dls.corp.google.com> Date: Mon, 24 Sep 2012 14:42:32 -0700 (PDT) From: xur@google.com (Rong Xu) X-Gm-Message-State: ALoCoQlhox+u6ihNhzR3/2C4KCR5L4Y5PJn9ErDn99cnHZmMr5ozfezfs7JRdFZF/w5aEdbS6APcXR/BuTX+ORDsxecQC8mp0Wl2G5XDvRhp5KAHimQqBb9nrmq2fKZqIMjt5yYY9E9s+6UMvFiYzGC58y/DrDTJwCJoQOk/TqKzDDUleKTfl9CHpJaVeszy+fRJTjeYXgsB X-IsSubscribed: yes 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 Hi, This is for google branches only. It fix the lino number checksum mismatch during LIPO-use build. Tested with SPEC and google internal banchmarks. Thanks, -Rong 2012-09-24 Rong Xu * gcc/coverage.c (coverage_checksum_string): strip out LIPO specific string. (crc32_string_1): New function. * gcc/cp/decl2.c (start_static_storage_duration_function): generate LIPO specific string. --- This patch is available for review at http://codereview.appspot.com/6566044 Index: gcc/coverage.c =================================================================== --- gcc/coverage.c (revision 191679) +++ gcc/coverage.c (working copy) @@ -903,6 +903,27 @@ } +/* Generate a crc32 of a string with specified STR_ELN when it's not 0. + Non-zero STR_LEN should only be seen in LIPO mode. */ +static unsigned +crc32_string_1 (unsigned chksum, const char *string, unsigned str_len) +{ + char *dup; + + if (!L_IPO_COMP_MODE || str_len == 0) + return crc32_string (chksum, string); + + gcc_assert (str_len > 0 && str_len < strlen(string)); + dup = xstrdup (string); + dup[str_len] = 0; + chksum = crc32_string (chksum, dup); + free (dup); + + return chksum; + + +} + /* Generate a checksum for a string. CHKSUM is the current checksum. */ @@ -911,7 +932,26 @@ { int i; char *dup = NULL; + unsigned lipo_orig_str_len = 0; + /* Strip out the ending "_cmo_[0-9]*" string from function + name. Otherwise we will have lineno checksum mismatch. */ + if (L_IPO_COMP_MODE) + { + int len; + + i = len = strlen (string); + while (i--) + if ((string[i] < '0' || string[i] > '9')) + break; + if ((i > 5) && (i != len - 1)) + { + if (!strncmp (string + i - 4, "_cmo_", 5)) + lipo_orig_str_len = i - 4; + } + + } + /* Look for everything that looks if it were produced by get_file_function_name and zero out the second part that may result from flag_random_seed. This is not critical @@ -957,7 +997,7 @@ } } - chksum = crc32_string (chksum, string); + chksum = crc32_string_1 (chksum, string, lipo_orig_str_len); if (dup) free (dup); Index: gcc/cp/decl2.c =================================================================== --- gcc/cp/decl2.c (revision 191679) +++ gcc/cp/decl2.c (working copy) @@ -2911,7 +2911,7 @@ SSDF_IDENTIFIER_. */ sprintf (id, "%s_%u", SSDF_IDENTIFIER, count); if (L_IPO_IS_AUXILIARY_MODULE) - sprintf (id, "%s_%u", id, current_module_id); + sprintf (id, "%s_cmo_%u", id, current_module_id); type = build_function_type_list (void_type_node, integer_type_node, integer_type_node,