From patchwork Tue Aug 21 12:20:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Baldwin X-Patchwork-Id: 179052 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 A82DA2C00BD for ; Tue, 21 Aug 2012 22:21:00 +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=1346156461; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=DbGtllZuj+MEQCsNT6xYmIsNhLc=; b=nTkzzjqKziLxjzj4kv6emz3j6m9QOgWffMkeh2lp1HuBVdB3qprRrTH+fCnrdk 80P9+dU8tMo0yVcIizv4pKFcHd82CpuIOq7wkrkE+1aLtgE/AVZ5bQ75RBGEH97a Nvf7IQQLbDRzuIb2TP3YqBw57rUe/rfPndutNfRYioc58= 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:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:X-System-Of-Record:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ruYpIg57+hVMmM6pUP5Q9D940HXVfh46rPRM6gsI7PJau882mOTAhmViYrQdWH uVHz9xsZUQe/d1WeIk5WzsPSYCeV+LY8BvKK0CgpOEgafbXGgciIy7g5LKLvwxmf 7+zJGAYuTNU7B499jY/xIO2tQuSmpfnt6M0IF0xv++QKU=; Received: (qmail 11322 invoked by alias); 21 Aug 2012 12:20:49 -0000 Received: (qmail 11304 invoked by uid 22791); 21 Aug 2012 12:20:45 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-wg0-f51.google.com (HELO mail-wg0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Aug 2012 12:20:28 +0000 Received: by wgbed3 with SMTP id ed3so4734089wgb.8 for ; Tue, 21 Aug 2012 05:20:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=rYOQ2wG2ygMeJrRxCDbDNEhIs74FFUES40r1fvay2oI=; b=P1QvO32/YZ3fGxeRyvem4VVlDkChEqu66vo/gk4v4pexy/sWVPUE29mEAoJ3k+OQFB HoI0JOXSPpS0zCoZNA7WqJ3T7ZnsAvDJO+/rjJpEzweY87zh2AQ+NCdQS0357BqEra8m G33sTroDCqkbLR2bX/MRfdv7Lx0Juk5x+23zNhUysUCDFiEDsd3SwirXtpNtdzbSVrCZ h/HPwbD/C9RA5WKpF9bfFg6YIZKSA9ZpnyGNEJtfcqcE3B6NIVEV1SSgjp4j8+e8NC7M fojclS9L9aAlcuoHYZWthQoQ0SGlj4GGs4NOOb7EV++jR9pXxQ873cUK8/20XranpxhU w6bQ== Received: by 10.180.7.200 with SMTP id l8mr37612004wia.9.1345551627006; Tue, 21 Aug 2012 05:20:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.180.7.200 with SMTP id l8mr37611986wia.9.1345551626906; Tue, 21 Aug 2012 05:20:26 -0700 (PDT) Received: by 10.216.65.145 with HTTP; Tue, 21 Aug 2012 05:20:26 -0700 (PDT) In-Reply-To: References: <20120816192850.GN1999@tucnak.redhat.com> Date: Tue, 21 Aug 2012 14:20:26 +0200 Message-ID: Subject: Re: Reproducible gcc builds, gfortran, and -grecord-gcc-switches From: Simon Baldwin To: "Joseph S. Myers" , gcc-patches@gcc.gnu.org Cc: Jakub Jelinek , Michael Matz , Gerald Pfeifer X-System-Of-Record: true X-Gm-Message-State: ALoCoQm48RLmGOSGXszrzlWCfxxJe6lhqCkCNj61Wz6lqJRfGc/BMkF0vlPUUusrjo8GJ2VlcVhivpVbrnFM6bFkXUgg89u8hHwvOop63eUdtVaIGhYr43BWKp3vPVKHryn7zbDSdE2M/tbNiYa2UhIZgQFJ9PUSlacOHuHt7FYwCUFjpyXTGt9SiVGpNVeAsH8v2aSz5mbA 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 On 20 August 2012 16:45, Joseph S. Myers wrote: > > On Mon, 20 Aug 2012, Simon Baldwin wrote: > > > > OPT_* for Fortran options only exist when the Fortran front-end is in the > > > source tree (whether or not enabled). I think we try to avoid knowingly > > > breaking use cases where people remove some front ends from the source > > > tree, although we don't actively test them and no longer provide split-up > > > source tarballs. > > > > Thanks for the update. Which fix should move forwards? > > I think the approach using a new option flag is the way to go, though the > patch needs (at least) documentation for the new flag in options.texi. > Updated version appended below. Okay for 4.8 trunk? ---------- Omit OPT_cpp_ from the DWARF producer string in gfortran. Gfortran uses -cpp= internally, and with -grecord_gcc_switches this command line switch is stored by default in object files. This causes problems with build and packaging systems that care about gcc binary reproducibility and file checksums; the temporary file is different on each compiler invocation. Fixed by adding a new opt marker NoDWARFRecord and associated flag, filtering options for this this setting when writing the producer string, and setting this flag for fortran -cpp= Tested for fortran (suppresses -cpp=...) and c (no effect). gcc/ChangeLog 2012-08-21 Simon Baldwin * dwarf2out.c (gen_producer_string): Omit command line switch if CL_NO_DWARF_RECORD flag set. * opts.c (print_specific_help): Add CL_NO_DWARF_RECORD handling. * opts.h (CL_NO_DWARF_RECORD): New. * opt-functions.awk (switch_flags): Add NoDWARFRecord. * doc/options.texi: Document NoDWARFRecord option flag. * doc/invoke.texi: Document --help=nodwarfrecord. gcc/fortran/ChangeLog 2012-08-21 Simon Baldwin * lang.opt (-cpp=): Mark flag NoDWARFRecord. --- Google UK Limited | Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ | Registered in England Number: 3977902 Index: gcc/doc/options.texi =================================================================== --- gcc/doc/options.texi (revision 190535) +++ gcc/doc/options.texi (working copy) @@ -468,4 +468,8 @@ of @option{-@var{opt}}, if not explicitl specify several different languages. Each @var{language} must have been declared by an earlier @code{Language} record. @xref{Option file format}. + +@item NoDWARFRecord +The option is added to the list of those omitted from the producer string +written by @option{-grecord-gcc-switches}. @end table Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 190535) +++ gcc/doc/invoke.texi (working copy) @@ -1330,6 +1330,10 @@ sign in the same continuous piece of tex @item @samp{separate} Display options taking an argument that appears as a separate word following the original option, such as: @samp{-o output-file}. + +@item @samp{nodwarfrecord} +Display only those options that are marked for addition to the list of +options omitted from @option{-grecord-gcc-switches}. @end table Thus for example to display all the undocumented target-specific Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 190535) +++ gcc/dwarf2out.c (working copy) @@ -18101,6 +18101,9 @@ gen_producer_string (void) /* Ignore these. */ continue; default: + if (cl_options[save_decoded_options[j].opt_index].flags + & CL_NO_DWARF_RECORD) + continue; gcc_checking_assert (save_decoded_options[j].canonical_option[0][0] == '-'); switch (save_decoded_options[j].canonical_option[0][1]) Index: gcc/opts.c =================================================================== --- gcc/opts.c (revision 190535) +++ gcc/opts.c (working copy) @@ -1186,7 +1186,9 @@ print_specific_help (unsigned int includ { if (any_flags == 0) { - if (include_flags & CL_UNDOCUMENTED) + if (include_flags & CL_NO_DWARF_RECORD) + description = _("The following options are not recorded by DWARF"); + else if (include_flags & CL_UNDOCUMENTED) description = _("The following options are not documented"); else if (include_flags & CL_SEPARATE) description = _("The following options take separate arguments"); @@ -1292,7 +1294,7 @@ common_handle_option (struct gcc_options /* Walk along the argument string, parsing each word in turn. The format is: arg = [^]{word}[,{arg}] - word = {optimizers|target|warnings|undocumented| + word = {optimizers|target|warnings|undocumented|nodwarfrecord| params|common|} */ while (* a != 0) { @@ -1307,6 +1309,7 @@ common_handle_option (struct gcc_options { "target", CL_TARGET }, { "warnings", CL_WARNING }, { "undocumented", CL_UNDOCUMENTED }, + { "nodwarfrecord", CL_NO_DWARF_RECORD }, { "params", CL_PARAMS }, { "joined", CL_JOINED }, { "separate", CL_SEPARATE }, Index: gcc/opts.h =================================================================== --- gcc/opts.h (revision 190535) +++ gcc/opts.h (working copy) @@ -145,6 +145,7 @@ extern const unsigned int cl_lang_count; #define CL_JOINED (1U << 22) /* If takes joined argument. */ #define CL_SEPARATE (1U << 23) /* If takes a separate argument. */ #define CL_UNDOCUMENTED (1U << 24) /* Do not output with --help. */ +#define CL_NO_DWARF_RECORD (1U << 25) /* Do not add to producer string. */ /* Flags for an enumerated option argument. */ #define CL_ENUM_CANONICAL (1 << 0) /* Canonical for this value. */ Index: gcc/fortran/lang.opt =================================================================== --- gcc/fortran/lang.opt (revision 190535) +++ gcc/fortran/lang.opt (working copy) @@ -295,7 +295,7 @@ Fortran Negative(nocpp) Enable preprocessing cpp= -Fortran Joined Negative(nocpp) Undocumented +Fortran Joined Negative(nocpp) Undocumented NoDWARFRecord ; Internal option generated by specs from -cpp. nocpp Index: gcc/opt-functions.awk =================================================================== --- gcc/opt-functions.awk (revision 190535) +++ gcc/opt-functions.awk (working copy) @@ -103,6 +103,7 @@ function switch_flags (flags) test_flag("JoinedOrMissing", flags, " | CL_JOINED") \ test_flag("Separate", flags, " | CL_SEPARATE") \ test_flag("Undocumented", flags, " | CL_UNDOCUMENTED") \ + test_flag("NoDWARFRecord", flags, " | CL_NO_DWARF_RECORD") \ test_flag("Warning", flags, " | CL_WARNING") \ test_flag("Optimization", flags, " | CL_OPTIMIZATION") sub( "^0 \\| ", "", result )