From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38316 invoked by alias); 10 Aug 2017 20:26:43 -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 38183 invoked by uid 89); 10 Aug 2017 20:26:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=answered, pkg-config, pkgconfig, from X-HELO: mail.headstrong.de Received: from mail.headstrong.de (HELO mail.headstrong.de) (81.7.4.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Aug 2017 20:26:34 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.headstrong.de (Postfix) with ESMTP id D8DC41C00D7A; Thu, 10 Aug 2017 22:26:31 +0200 (CEST) Received: from mail.headstrong.de ([127.0.0.1]) by localhost (mail.headstrong.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id E954sSGjMk6U; Thu, 10 Aug 2017 22:26:24 +0200 (CEST) Subject: Re: [PING^4][PATCH v2] Generate reproducible output independently of the build-path To: Yury Gribov Cc: Jeff Law , GCC Patches References: <20170721161538.7508-1-infinity0@pwned.gg> <3136125b-bd88-7c0b-504e-a4e4de545bbb@redhat.com> <4b6c844f-9a46-4a4b-48c5-9dfeac54b97f@pwned.gg> <565c6de9-2d85-24f9-faaf-6d8ac476b3a8@gmail.com> From: Ximin Luo Message-ID: <03d07491-59ab-4a71-616c-662a22531eb8@pwned.gg> Date: Thu, 10 Aug 2017 21:29:00 -0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-08/txt/msg00767.txt.bz2 Yury Gribov: > On Thu, Aug 3, 2017 at 12:45 PM, Ximin Luo wrote: >> Yury Gribov: >>> [..] >>> >>> Shouldn't -fdebug-prefix-map be updated to use the same syntax as BUILD_PATH_PREFIX_MAP? >>> >> >> -fdebug-prefix-map is a CLI option and can be given multiple times, each flag given is in the form of $from=$to where $from can't contain a '='. >> >> BUILD_PATH_PREFIX_MAP is a single envvar that encodes a list-of-pairs of the form $to=$from:$to=$from with some escaping for flexibility and to support things like windows paths. Since it's a new envvar, Ian Jackson suggested $to=$from to emphasise the reproducible ($to) part. I liked the idea so I implemented it like that. (We did a lot of bikeshedding over on the rb-general mailing list about the exact format and this is what we settled on, I'd like to avoid getting into that again but would nevertheless do it, if it's necessary to get this patch accepted.) >> >> Because -fdebug-prefix-map currently only encodes one $from=$to pair, it would be a very disruptive and highly backward-incompatible change to make it use the same syntax as B_P_P_M. A slightly less disruptive but still backward-incompatible change would be to make it encode a single $to=$from pair, but I don't really see the advantage to doing so - what were your thoughts on this? > > I believe it would much easier to reason about environment variable > behavior when it boils down to "prepend some standard flag to > command-line flags". It would also simplify maintenance of local > compiler patch as core functionality can be merged to mainline GCC > whereas debatable environment variable part stays in the distro. > [answered in another email together with other related points] >> 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. > > Just curious, why -fdebug-prefix-map (maybe modified to support > multiple renames) was not enough for these packages (and why they > can't be fixed instead)? > One important reason is that some packages embed CFLAGS/CXXFLAGS in build output such as pkg-config files or Makefiles to be installed as examples. To fix this, we'd have to add buildsystem-specific logic to strip out -fdebug-prefix-map when it was writing such output. This does not affect all of these 1800 packages, but I saw enough cases that I was convinced that the use of a new envvar was a better approach - I don't think buildsystems should be burdened with having to know "which flag values are reproducible vs not", this is not the case with other CFLAGS. X -- GPG: ed25519/56034877E1F87C35 GPG: rsa4096/1318EFAC5FBBDBCE https://github.com/infinity0/pubkeys.git