From patchwork Tue Oct 8 10:50:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Spooren X-Patchwork-Id: 1173177 X-Patchwork-Delegate: ynezz@true.cz 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=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aparcar.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Icbf+6rc"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46nYzS2GN3z9sP7 for ; Tue, 8 Oct 2019 21:50:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=GDv9HF9EVLhM/XdirfK2JlsilJD5pvSsr7icBQpKssE=; b=Icbf+6rcMzKzKS 586DvvAUEORzZBB+HfKQU717v6SdcmJYLzb362zqSeqns74gr6tc8O5pOB77YgeCRqcSquJMkcRvw CZ0a2WNeMRS0Em6qRzKFiqHU5QgNDuk6S6E50Tyqkp6vV2f5fOX86r+RWB2y2nFcBKMM5oIuyV4IT j/eBlKh2r9axZsnWPxxuc6BqCXkN/IprLPWBtp9KcF3I3EkJ5Mjr8NXcpZJaNF93N4dyGxHn7EHg3 NjHGV0i3M9La86s9FFdKZf1zHF7oYUELAaKQp3lkr7FQzxKvwnS8Z6q0kBwzBrq6Aa/PWenDg/KDH oEuUoiWbK1+YKMI5rB/Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iHn4R-0007n3-Le; Tue, 08 Oct 2019 10:50:23 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iHn4O-0007mY-Pe for openwrt-devel@lists.openwrt.org; Tue, 08 Oct 2019 10:50:22 +0000 X-Originating-IP: 98.151.65.6 Received: from localhost.localdomain (cpe-98-151-65-6.hawaii.res.rr.com [98.151.65.6]) (Authenticated sender: mail@aparcar.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 07897C0008; Tue, 8 Oct 2019 10:50:05 +0000 (UTC) From: Paul Spooren To: openwrt-devel@lists.openwrt.org Date: Tue, 8 Oct 2019 00:50:00 -1000 Message-Id: <20191008105000.11543-1-mail@aparcar.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191008_035021_104162_0844FDC1 X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.183.198 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record Subject: [OpenWrt-Devel] [PATCH v3] toolchain/gcc: switch to version 8 by default X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= , Andre Heider Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Main motivation for this commit is the introduction of `-ffile-prefix-map=` which alows reproducible build path. The usage of `-ffile-prefix-map=` in include/kernel.mk adds reproducibility to kmods like gpio-hotplug and wireguard which before stored the build path as debug information in .rodata. Compiling tested without errors on the following targets: * ath79 * brcm2708 * brcm63xx * ixp4xx * ramips * sunxi * x86 CC: Andre Heider CC: Petr Štetiar Thanks to Andre for the iremap fixup Thanks to Petr for his patience on helping which screws to tweak Signed-off-by: Paul Spooren --- v3: add KCFLAGS to make kmods reproducible config/Config-build.in | 2 -- include/kernel.mk | 1 + .../patches/120-strip-cflags-from-binary.patch | 2 +- rules.mk | 8 ++++---- toolchain/gcc/Config.in | 8 ++++++-- toolchain/gcc/Config.version | 14 ++++---------- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/config/Config-build.in b/config/Config-build.in index 9669fc86c7..872e5c12ab 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -243,7 +243,6 @@ menu "Global build settings" config PKG_CC_STACKPROTECTOR_STRONG bool "Strong" select GCC_LIBSSP if !USE_MUSL - depends on !GCC_VERSION_4_8 depends on KERNEL_CC_STACKPROTECTOR_STRONG endchoice @@ -258,7 +257,6 @@ menu "Global build settings" config KERNEL_CC_STACKPROTECTOR_REGULAR bool "Regular" config KERNEL_CC_STACKPROTECTOR_STRONG - depends on !GCC_VERSION_4_8 bool "Strong" endchoice diff --git a/include/kernel.mk b/include/kernel.mk index 97d23661c9..451f5bdee3 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -104,6 +104,7 @@ endif KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS) KERNEL_MAKE_FLAGS = \ + KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR)))" \ HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \ CROSS_COMPILE="$(KERNEL_CROSS)" \ ARCH="$(LINUX_KARCH)" \ diff --git a/package/libs/openssl/patches/120-strip-cflags-from-binary.patch b/package/libs/openssl/patches/120-strip-cflags-from-binary.patch index 75fb9d1684..7faec9ab88 100644 --- a/package/libs/openssl/patches/120-strip-cflags-from-binary.patch +++ b/package/libs/openssl/patches/120-strip-cflags-from-binary.patch @@ -17,7 +17,7 @@ index 2c619c62e8..893128345a 100644 DEPEND[cversion.o]=buildinf.h -GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)" -+GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(filter-out -I% -iremap% -fmacro-prefix-map%,$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q))" "$(PLATFORM)" ++GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(filter-out -I% -iremap% -fmacro-prefix-map% -ffile-prefix-map%,$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q))" "$(PLATFORM)" DEPEND[buildinf.h]=../configdata.pm GENERATE[uplink-x86.s]=../ms/uplink-x86.pl $(PERLASM_SCHEME) diff --git a/rules.mk b/rules.mk index b140fbca70..7063cf3ad6 100644 --- a/rules.mk +++ b/rules.mk @@ -139,11 +139,11 @@ else TOOLCHAIN_DIR_NAME:=toolchain-$(GNU_TARGET_NAME) endif -ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_GCC_VERSION_4_8),$(CONFIG_TARGET_uml)),) - ifeq ($(CONFIG_GCC_USE_EMBEDDED_PATH_REMAP),y) - iremap = -fmacro-prefix-map=$(1)=$(2) - else +ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_TARGET_uml)),) + ifeq ($(CONFIG_GCC_USE_IREMAP),y) iremap = -iremap$(1):$(2) + else + iremap = -ffile-prefix-map=$(1)=$(2) endif endif diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index 0977f9b4e7..3882815d7f 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -2,8 +2,7 @@ choice prompt "GCC compiler Version" if TOOLCHAINOPTS - default GCC_USE_VERSION_8 if arc - default GCC_USE_VERSION_7 + default GCC_USE_VERSION_8 help Select the version of gcc you wish to use. @@ -22,6 +21,11 @@ choice bool "gcc 9.x" endchoice +config GCC_USE_IREMAP + default y if ( GCC_USE_VERSION_5 || GCC_USE_VERSION_7 ) + default n + bool + config GCC_USE_GRAPHITE bool prompt "Compile in support for the new Graphite framework in GCC 4.4+" if TOOLCHAINOPTS diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version index d9732b3e0d..0658f3d52b 100644 --- a/toolchain/gcc/Config.version +++ b/toolchain/gcc/Config.version @@ -2,23 +2,17 @@ config GCC_VERSION_5 default y if GCC_USE_VERSION_5 bool -config GCC_VERSION_8 - default y if GCC_USE_VERSION_8 - default y if arc && !GCC_USE_VERSION_9 +config GCC_VERSION_7 + default y if GCC_USE_VERSION_7 bool config GCC_VERSION_9 default y if GCC_USE_VERSION_9 bool -config GCC_USE_EMBEDDED_PATH_REMAP - default y if ( GCC_VERSION_8 || GCC_VERSION_9 ) - default n - bool - config GCC_VERSION string default "5.5.0" if GCC_VERSION_5 - default "8.3.0" if GCC_VERSION_8 + default "7.4.0" if GCC_VERSION_7 default "9.2.0" if GCC_VERSION_9 - default "7.4.0" + default "8.3.0"