Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3427038pxv; Sun, 4 Jul 2021 19:04:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXMWcK0nZi+IAJzitBr99QeoKTi1Jey7epdUXjPQzauCMCPQvlM39QIFlmeOTm620lKy4Z X-Received: by 2002:a05:6638:d4d:: with SMTP id d13mr1045597jak.140.1625450694537; Sun, 04 Jul 2021 19:04:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625450694; cv=none; d=google.com; s=arc-20160816; b=LNRcvCi4fQdEB0dn5JOTcC3jTF9aReT7aBCfYBQ0G+pnZ2/HrRqR2f9ii/hLYPeHXb cKD+q640rJt1uXMmjLE5RE/aq8tAMXBctS5AnUEyESuQX9aLB/ndw+nJIQaMTClWxiln YuCH4tCccL+nlSFqRGv3Jw29sr3s1A37LRbWWN1UaLeyApvMV80kvLO0jbNi++XhWAAA wPF3/IoiVNS3Q3kuvXcMYXhFv8fVWPXA2NyppFyjGJaNn+9GDex6Mej3Z2bPfR+AfOe3 xczKRw3vvroe1pBTGTBMGwK720tQuQMnSiEIYKBc1wZYVtInTB893uJRWgDX+F33E8nK iraw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=i6TqbcfWRrqlvlGxRh4UhpNAO4m8Y8977j2FL6bcy68=; b=BE640f/O9oqB0lO3Uoqxvm+/6TbAYKWeltiwhLEK1D8N3bpkLRfHAhoInoQ2d1U626 QkYy/mVzDdDuQxcJUFlQGCYWKZ/DM+oDzgemRCArVwCfygoQegmB4h8xqRGvb4ZYD1BV 6/PplH0PKzyha7Iwxj90pJAbumw4uxX0cROuIQeKJaQe4eZ3NqHpSNhIJ4kzSRD/qyCV m0AZmavb/OPg125XLSjTYDkr4l1BT8QTSnLZkyGuCbx4evqsYCdfvmgwRIVGouXiTuYH EIzccdvF5ZSPbx7R4FwrBkHF4hpQHvJDPyzTiaU6N1Lhi62VQ6H1uZs2iJii/13/0pfU IREw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=atZdeBL7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si14785721jat.31.2021.07.04.19.04.31; Sun, 04 Jul 2021 19:04:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=atZdeBL7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229740AbhGECGN (ORCPT + 99 others); Sun, 4 Jul 2021 22:06:13 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:45179 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbhGECGN (ORCPT ); Sun, 4 Jul 2021 22:06:13 -0400 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 16523Jpt010664; Mon, 5 Jul 2021 11:03:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 16523Jpt010664 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1625450599; bh=i6TqbcfWRrqlvlGxRh4UhpNAO4m8Y8977j2FL6bcy68=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=atZdeBL7jys/wwkgQQFZEKxiLAamu7xob3+AEsxkRCRybp0KH98VV64yBSFXJ6e5D zV+kfJ+7WJj92SFM5wRmydPredWAAGIijBsNPadOXIwDIZbKN1j/S+mhD/biuCnjHm yzE+mALnys5LI9TXvv/qpauMkkDGmjJeIVYqHL56r15/veN7S+gKrzRWqjEdPOgRyV B9eigxV9XN4hT5i3py6L4C/U+7pWUy3Mtta0t5ioNqfWypoiNf3uf4qUfcjKfzGEvE 0ww/+OO9oN0d+rAH48zWqKBc0DtGXhKYm038ptDg6Qxl6N3aifHGecLX8fYwiaSgy2 s35VXQb6YryYQ== X-Nifty-SrcIP: [209.85.216.42] Received: by mail-pj1-f42.google.com with SMTP id ie21so9069064pjb.0; Sun, 04 Jul 2021 19:03:19 -0700 (PDT) X-Gm-Message-State: AOAM530t5a/8cLTrcIbl7eqJud8V9/CixpkvZW4CJe6GSljOla1GRBHM Dxt4LYk26vRFGbizozUymiGuOeLW66ncqZSXw5E= X-Received: by 2002:a17:90b:4d81:: with SMTP id oj1mr12215610pjb.153.1625450598996; Sun, 04 Jul 2021 19:03:18 -0700 (PDT) MIME-Version: 1.0 References: <20210702032943.7865-1-lecopzer.chen@mediatek.com> <20210702032943.7865-2-lecopzer.chen@mediatek.com> In-Reply-To: <20210702032943.7865-2-lecopzer.chen@mediatek.com> From: Masahiro Yamada Date: Mon, 5 Jul 2021 11:02:42 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 1/2] Kbuild: lto: add CONFIG_MAKE_VERSION To: Lecopzer Chen Cc: Nick Desaulniers , Kees Cook , Sami Tolvanen , Linux Kbuild mailing list , Nathan Chancellor , clang-built-linux , Linux Kernel Mailing List , yj.chiang@mediatek.com, Michal Marek Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 2, 2021 at 12:29 PM Lecopzer Chen wrote: > > To check the GNU make version. Used by the LTO Kconfig. > > LTO with MODVERSIONS will fail in generating correct CRC because > the makefile rule doesn't work for make with version 3.8X.[1] > > Thus we need to check make version during selecting on LTO Kconfig. > Add CONFIG_MAKE_VERSION which means MAKE_VERSION in canonical digits > for arithmetic comparisons. > > [1] https://lore.kernel.org/lkml/20210616080252.32046-1-lecopzer.chen@mediatek.com/ > Signed-off-by: Lecopzer Chen > --- NACK. "Let's add MAKE_VERSION >= 40200 restriction just because I cannot write correct code that works for older Make" is a horrible idea. Also, Kconfig is supposed to check the compiler (or toolchains) capability, not host tool versions. > Makefile | 2 +- > init/Kconfig | 4 ++++ > scripts/make-version.sh | 13 +++++++++++++ > 3 files changed, 18 insertions(+), 1 deletion(-) > create mode 100755 scripts/make-version.sh > > diff --git a/Makefile b/Makefile > index 88888fff4c62..2402745b2ba9 100644 > --- a/Makefile > +++ b/Makefile > @@ -516,7 +516,7 @@ CLANG_FLAGS := > > export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC > export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL > -export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX > +export PERL PYTHON3 CHECK CHECKFLAGS MAKE MAKE_VERSION UTS_MACHINE HOSTCXX > export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD > export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE > > diff --git a/init/Kconfig b/init/Kconfig > index 55f9f7738ebb..ecc110504f87 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -86,6 +86,10 @@ config CC_HAS_ASM_INLINE > config CC_HAS_NO_PROFILE_FN_ATTR > def_bool $(success,echo '__attribute__((no_profile_instrument_function)) int x();' | $(CC) -x c - -c -o /dev/null -Werror) > > +config MAKE_VERSION > + int > + default $(shell,$(srctree)/scripts/make-version.sh $(MAKE_VERSION)) > + > config CONSTRUCTORS > bool > > diff --git a/scripts/make-version.sh b/scripts/make-version.sh > new file mode 100755 > index 000000000000..3a451db3c067 > --- /dev/null > +++ b/scripts/make-version.sh > @@ -0,0 +1,13 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > +# > +# Print the GNU make version in a 5 or 6-digit form. > + > +set -e > + > +# Convert the version string x.y.z to a canonical 5 or 6-digit form. > +IFS=. > +set -- $1 > + > +# If the 2nd or 3rd field is missing, fill it with a zero. > +echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0})) > -- > 2.18.0 > -- Best Regards Masahiro Yamada