From patchwork Wed Apr 15 22:00:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 1271431 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rockwellcollins.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 492brt3HSTz9s71 for ; Thu, 16 Apr 2020 08:00:46 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id EF6178749A; Wed, 15 Apr 2020 22:00:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VQ9B6NkSbNzO; Wed, 15 Apr 2020 22:00:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 5390F87CDD; Wed, 15 Apr 2020 22:00:44 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 20A431BF4D5 for ; Wed, 15 Apr 2020 22:00:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1D30C2206E for ; Wed, 15 Apr 2020 22:00:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jW93wFqdnPDW for ; Wed, 15 Apr 2020 22:00:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from da1vs04.rockwellcollins.com (da1vs04.rockwellcollins.com [205.175.227.52]) by silver.osuosl.org (Postfix) with ESMTPS id 15BA22207F for ; Wed, 15 Apr 2020 22:00:40 +0000 (UTC) IronPort-SDR: yTj5tpfbeb1m10CQVMlrk39xjpvnH2MsXd2SpZedkjk6ZCCP/i+DUWt0/9sC+/yxKl5KeHQH6M nueSJZ96gq55Wot9cF6yG/OLrXkWnAU14Aj5ntzgjl1xHmDq6BWfm2VxD36hBQWOPRj1z6xmp5 T0w13kDwWj03bFEyJqOfVQSF1VX8BI/EkPkaPt70giF0rpC3x0R12RstLIh25rPafvlXg8BlUd Go7WvjuKJCPGmaRMqSHfIVn5rHEjZWLVMP+CMSK+cPRORjJ2C4QfV9nApGLtfSSrQpUM9MIPSN X3w= Received: from ofwda1n02.rockwellcollins.com (HELO dtulimr01.rockwellcollins.com) ([205.175.227.14]) by da1vs04.rockwellcollins.com with ESMTP; 15 Apr 2020 17:00:40 -0500 X-Received: from righttwix.rockwellcollins.com (righttwix.rockwellcollins.com [192.168.141.218]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id C6F0A603CA; Wed, 15 Apr 2020 17:00:39 -0500 (CDT) From: Brandon Maier To: buildroot@buildroot.org Date: Wed, 15 Apr 2020 17:00:31 -0500 Message-Id: <20200415220032.140083-1-brandon.maier@rockwellcollins.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper: Handle debug info paths in gcc7 or below for reproducibility X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: matthew.weber@rockwellcollins.com, Brandon Maier , Thomas De Schampheleire , Thomas Petazzoni , Romain Naour Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" In GCC8 the flag -ffile-prefix-map handles cleaning up both the __FILE__ macros and the debug info paths. In GCC7 or below we are manually handling the __FILE__ macros, but not debug info paths. Use -fdebug-prefix-map to clean them up. See for more detail: https://reproducible-builds.org/docs/build-path/ Signed-off-by: Brandon Maier --- toolchain/toolchain-wrapper.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk index 09dda17890..7d55050135 100644 --- a/toolchain/toolchain-wrapper.mk +++ b/toolchain/toolchain-wrapper.mk @@ -26,6 +26,7 @@ TOOLCHAIN_WRAPPER_OPTS += -Wl,--build-id=none ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y) TOOLCHAIN_WRAPPER_OPTS += -ffile-prefix-map=$(BASE_DIR)=buildroot else +TOOLCHAIN_WRAPPER_OPTS += -fdebug-prefix-map=$(BASE_DIR)=buildroot TOOLCHAIN_WRAPPER_OPTS += -D__FILE__=\"\" -D__BASE_FILE__=\"\" -Wno-builtin-macro-redefined endif endif From patchwork Wed Apr 15 22:00:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 1271432 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rockwellcollins.com Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 492brz49bmz9s71 for ; Thu, 16 Apr 2020 08:00:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6A6AF220C5; Wed, 15 Apr 2020 22:00:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wGyUI9n4AsXq; Wed, 15 Apr 2020 22:00:46 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 8447B220CE; Wed, 15 Apr 2020 22:00:46 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id E8D421BF4D5 for ; Wed, 15 Apr 2020 22:00:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E3E74220C5 for ; Wed, 15 Apr 2020 22:00:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I08O8wbhG+7A for ; Wed, 15 Apr 2020 22:00:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ch3vs03.rockwellcollins.com (ch3vs03.rockwellcollins.com [205.175.226.47]) by silver.osuosl.org (Postfix) with ESMTPS id C3FAD220EC for ; Wed, 15 Apr 2020 22:00:42 +0000 (UTC) IronPort-SDR: mJrbz6NwLkcL9bC279uPFY1fJn+jeOxNWxZqvpFD6Cbs7xEuLaPh8373SwFU2V2CkhoRLc51NH 8LnNcegHY8K1u/lAh9KJWetl22s4tIsUEUA3lvqgwdNWEU8xwkWWepQCxpKAGqLj7qhsGOcYCI Q9cC54O5yVmgB6B2AcDp1C9FWyJ+tEOXQeGJ2pNFvYvuf5fzIqdWrCW6tE6DxnFyQWqM6JxDfY sFxb4WD3q4qM1a36m02AmvOFs4aXP5QoQ35sUFIWYA+3j0l4YDaGw3871zKCmssi8rc2hw71sH AVM= Received: from ofwch3n02.rockwellcollins.com (HELO dtulimr01.rockwellcollins.com) ([205.175.226.14]) by ch3vs03.rockwellcollins.com with ESMTP; 15 Apr 2020 17:00:40 -0500 X-Received: from righttwix.rockwellcollins.com (righttwix.rockwellcollins.com [192.168.141.218]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id 32A8C603C5; Wed, 15 Apr 2020 17:00:40 -0500 (CDT) From: Brandon Maier To: buildroot@buildroot.org Date: Wed, 15 Apr 2020 17:00:32 -0500 Message-Id: <20200415220032.140083-2-brandon.maier@rockwellcollins.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200415220032.140083-1-brandon.maier@rockwellcollins.com> References: <20200415220032.140083-1-brandon.maier@rockwellcollins.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/2] toolchain/toolchain-wrapper: Omit absolute paths from debug symbols for reproducibility X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: matthew.weber@rockwellcollins.com, Brandon Maier , Thomas De Schampheleire , Thomas Petazzoni , Romain Naour Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" In GCC6 the compiler was made smarter to omit the flag -fdebug-prefix-map from the DWARF DW_AT_producer section[1]. That flag contains the absolute path '$(BASE_DIR)' which breaks reproducibility. Prior to GCC6 however, the only way to omit the flag is to use -gno-record-gcc-switches which omits all flags. [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=266cc0c181549c2fb6b50f8f26213cdc89101026 Signed-off-by: Brandon Maier --- toolchain/toolchain-wrapper.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk index 7d55050135..291366b093 100644 --- a/toolchain/toolchain-wrapper.mk +++ b/toolchain/toolchain-wrapper.mk @@ -29,6 +29,9 @@ else TOOLCHAIN_WRAPPER_OPTS += -fdebug-prefix-map=$(BASE_DIR)=buildroot TOOLCHAIN_WRAPPER_OPTS += -D__FILE__=\"\" -D__BASE_FILE__=\"\" -Wno-builtin-macro-redefined endif +ifneq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_6),y) +TOOLCHAIN_WRAPPER_OPTS += -gno-record-gcc-switches +endif endif # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a