From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5793 invoked by alias); 4 Aug 2017 12:32:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 1259 invoked by uid 89); 4 Aug 2017 12:32:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=H*Ad:D*debian.org, our X-HELO: einhorn-mail.in-berlin.de Received: from einhorn-mail.in-berlin.de (HELO einhorn-mail.in-berlin.de) (217.197.80.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 04 Aug 2017 12:32:42 +0000 X-Envelope-From: doko@debian.org Received: from [192.168.1.52] ([104.158.61.93]) (authenticated bits=0) by einhorn.in-berlin.de (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id v74CWYST032352 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 4 Aug 2017 14:32:37 +0200 Subject: Re: [PING^4][PATCH v2] Generate reproducible output independently of the build-path To: Jeff Law , Ximin Luo , GCC Patches References: <20170721161538.7508-1-infinity0@pwned.gg> <3136125b-bd88-7c0b-504e-a4e4de545bbb@redhat.com> <4b6c844f-9a46-4a4b-48c5-9dfeac54b97f@pwned.gg> From: Matthias Klose Message-ID: <7e11eaf0-99fe-e1b3-3396-df7642a56cdc@debian.org> Date: Fri, 04 Aug 2017 12:32:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00380.txt.bz2 On 03.08.2017 12:05, Jeff Law wrote: > On 08/02/2017 08:06 PM, Ximin Luo wrote: >> Jeff Law: >>> On 07/21/2017 10:15 AM, Ximin Luo wrote: >>>> (Please keep me on CC, I am not subscribed) >>>> >>>> >>>> Proposal >>>> ======== >>>> >>>> This patch series adds a new environment variable BUILD_PATH_PREFIX_MAP. When >>>> this is set, GCC will treat this as extra implicit "-fdebug-prefix-map=$value" >>>> command-line arguments that precede any explicit ones. This makes the final >>>> binary output reproducible, and also hides the unreproducible value (the source >>>> path prefixes) from CFLAGS et. al. which many build tools (understandably) >>>> embed as-is into their build output. >>> I'd *really* avoid doing this with magic environment variables. Make it >>> a first class option to the compiler. Yes, it means projects that want >>> this behavior have to arrange to pass that flag to their compiler, but >>> IMHO that's much preferred over environment variables. >>> >>> Jeff >>> >> >> Hi Jeff, >> >> If by "first class option" you meant a command-line flag, GCC *already has* that (-fdebug-prefix-map) and it wasn't enough to achieve reproducibility in many cases we tested. dpkg-buildflags actually already adds these flags to CFLAGS CXXFLAGS etc on Debian. However, with this patch using the environment variable, we are able to reproduce 1800 more packages out of 26000.Then take what you've done with the environment variable and instead > implement it on top of a switch. An environment variable is absolutely > the wrong thing to do here. > >> >> GCC already supports a similar environment variable SOURCE_DATE_EPOCH, which was accepted about 2 years ago in a patch written by one of our GSoC students. We are not planning any more environment variables like this, and are committed to fixing other sources of non-determinism by patching the relevant build scripts. > I would have rejected that as well :-) One of the few times I would > have disagreed with Bernd. You can argue that gcc has command line options to set these, but most build systems can be influenced by well documented environment variables like CFLAGS, CXXFLAGS, LDFLAGS, so adding one more variable like SOURCE_DATE_EPOCH makes sense, considering that many tools dealing with timestamps don't even have command line options to do these (and there it's not just about compilers). BUILD_PATH_PREFIX_MAP might be passed as well in CFLAGS / CXXFLAGS, but there are build systems that even ignore these environment variables, and it's common to require the use of environment variables for distributions, like http://pkgs.fedoraproject.org/cgit/rpms/gcc.git/tree/gcc7-foffload-default.patch If changes like that are not allowed to go upstream, where do you want to keep these instead, and keeping these in sync across distributions? Matthias