From patchwork Fri Oct 6 01:15:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 822146 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-463587-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="izC0ohJx"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y7Wt74wk3z9t2h for ; Fri, 6 Oct 2017 12:15:54 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=K57Z4vMXTE5mQHK1W40gRVLdZhxh4Si1+9XBKDhjeOc+KrbXnCnbw tHtTem5ptlrJ5rRqqYH2jH6sTuR7lIeNp9G+fvPBQQDeVlAwcmxYFrkyjnYf2sP2 X8tt4lAIwvKoKUk6L0rb0t/qtSq/JoP2Nd2QFhry9YqKx/0LZn6ros= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=sdG03XFngDrA3u/C0TvGoGIPV5g=; b=izC0ohJxn6paUmvgBFgL BJJ+pFO9QN8SDE9008bKJxCe73aEmE5sdckCHbP7GVZqCCh9zjeWilADkfICV1Wc 6RSwIJQh2jbTTbHBA6C3GlcM/5SStHhY4WsAEFq8EvNV8JbMlExz8XAnfQuS0es1 +ghgfgUKloeuZlS7KDJZxzY= Received: (qmail 43423 invoked by alias); 6 Oct 2017 01:15:47 -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 42753 invoked by uid 89); 6 Oct 2017 01:15:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Free!, Brasil, brasil, fighter X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Oct 2017 01:15:45 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D9B90883AD for ; Fri, 6 Oct 2017 01:15:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D9B90883AD Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=aoliva@redhat.com Received: from freie.home (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C9D45D9C0 for ; Fri, 6 Oct 2017 01:15:43 +0000 (UTC) Received: from livre (livre.home [172.31.160.2]) by freie.home (8.15.2/8.15.2) with ESMTP id v961FHJS023937; Thu, 5 Oct 2017 22:15:19 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: bootstrap-debug-lean + flags in producer vs compare Date: Thu, 05 Oct 2017 22:15:17 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Unlike bootstrap-debug, bootstrap-debug-lean used to pass compare using the traditional compare command, because it compiled both stage2 and stage3 with options that used to generate identical output (-fcompare-debug= in stage2 vs -fcompare-debug in stage3). Since we started adding relevant command-line flags to DW_AT_producer, this is no longer the case, and stages 2 and 3 object files that differ in nothing but the DW_AT_producer strings. -fcompare-debug is short for -fcompare-debug=-gtoggle, so stage3 compiles twice, once with the normal options, once with toggled -g, to then compare the temporary final dumps. When enabled, both compilations get from the driver an additional -frandom-seed flag (if none is given explicitly). -fcompare-debug= is short for -fno-compare-debug, disabling the second compilation. The difference between the DW_AT_producer lines are the different -fcompare-debug flags, and the presence of the -frandom-seed flag in the stage3 compilation. It should be easy and sensible enough to filter the -fcompare-debug flags out of the DW_AT_producer string. This option should never affect the compilation output, it just determines whether or not to perform an additional compilation that should produce the same executable output. However, doing that but that won't get us rid of the -frandom-seed option. We could drop -frandom-seed from the DW_AT_producer output too, but I don't think we should do that when the option is given by the user, rather than implicitly introduced by -fcompare-debug. We could introduce an option that causes the subsequent option to be omitted from the DW_AT_producer string, and arrange for -fcompare-debug to issue that option before the -frandom-seed option it issues. The problem with this approach is that I can't decide whether it's an option prone to abuse, or one that can have other legitimate uses. Another approach to fix (or rather hide) this failure mode is to allow the debug information to differ under bootstrap-debug-lean, by using the same compare-debug script we use for bootstrap-debug. The first patchlet below does just that. The second drops -fcompare-debug from DW_AT_producer. A third (not written yet :-) might somehow deal with the -frandom-seed added by -fcompare-debug, and either the first or the others would be posted as a single, fully tested patch, once we decide how we want to deal with -frandom-seed. Thoughts? Thanks in advance, diff --git a/config/bootstrap-debug-lean.mk b/config/bootstrap-debug-lean.mk index e215280..5f2db80 100644 --- a/config/bootstrap-debug-lean.mk +++ b/config/bootstrap-debug-lean.mk @@ -9,3 +9,4 @@ STAGE2_CFLAGS += -fcompare-debug= STAGE3_CFLAGS += -fcompare-debug +do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index ed7a85a..f077b35 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -23846,6 +23846,7 @@ gen_producer_string (void) case OPT_fltrans_output_list_: case OPT_fresolution_: case OPT_fdebug_prefix_map_: + case OPT_fcompare_debug: /* Ignore these. */ continue; default: