From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.7 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92F87C07E9B for ; Mon, 5 Jul 2021 17:59:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A57A61261 for ; Mon, 5 Jul 2021 17:59:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbhGESC3 (ORCPT ); Mon, 5 Jul 2021 14:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbhGESC2 (ORCPT ); Mon, 5 Jul 2021 14:02:28 -0400 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4741BC061760 for ; Mon, 5 Jul 2021 10:59:51 -0700 (PDT) Received: by mail-yb1-xb32.google.com with SMTP id s129so30318224ybf.3 for ; Mon, 05 Jul 2021 10:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gJsboDNld2P6AbWlug6aDXd7eLnwEy72n526BJjJ3p4=; b=EXqSe5LBsLsLCtQiC8U/5Swb48WLpeSqS53eK2HIJRAVgtZeLSLS8A1wZ6eHgnCvc7 yYyGiLzAg5kHHmj95ZJwzrQ8+jiI4dQIXuPBYD7eArDwyslmw/KUjaqixVz80HIs95cr opGbcBdxR62OF1sDMSjE7x1ZLMoRMQmzc5qtxYCbwHFwtgMrkbYWcghfWg40xwCrlesM l5YSUUfyLiwe1VQhV0mf7mEohw9ZYV21sksVI7UpkbYqM2FiLK+3tG2Pw1EIEEqlsF1Q IijD4D61dFjQycgonxf9i5m6dzoYTs+ATalj6Gb5PIhriSMhzPu03lgiYC8BLJMqiJJX EuVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gJsboDNld2P6AbWlug6aDXd7eLnwEy72n526BJjJ3p4=; b=ikdx8lLwniRpwVYP1tJ7cT2RbZlt0cHXFNpwO9M+biaYxi7JtGleAR3a3x84oa2qO6 E4MwRFYRy4dNPl3ENIWncIt51/jspIJBaHNBJ2KOuQVepLiNE9CwSO/AxznaEgPskfpr lgLm/5O3V1jnPyolpkvlWKMooiwDG41g7WfEoSwxEMfbtcOL5GsgnVsPECGNcJOJuPiS +xz2vi+X3EBZy0UiVHtrL7ZY21sP8JnwBZPAhuonKyq5Q4ma7j7VQ7UY8jttt276+fSI Qdq3CD4cxdXBeYv3wIlTHr2iMUzhnW1jr/QPottwY7VAFPYmSCDoy8g8BrNPADYyqRZi RHug== X-Gm-Message-State: AOAM531b21JjmSy1Yhe/PcOICm4K94gTu/ZsxNeetpcX6fvtmoSfpxW5 GkpbwcQdZMXOG2yKvq6+jk8RVHEcuayWbR+2TPsdZQ== X-Google-Smtp-Source: ABdhPJyvaS7gUP6HUAzHKKgtRP4C9Mp35iZpjbSbMDDM8Y8tIigQktn8iFhCJSpMTQY4LzKuFxygyboKlXkIdveVT8U= X-Received: by 2002:a25:7b86:: with SMTP id w128mr20063583ybc.273.1625507990140; Mon, 05 Jul 2021 10:59:50 -0700 (PDT) MIME-Version: 1.0 References: <20210702032943.7865-1-lecopzer.chen@mediatek.com> <20210702032943.7865-2-lecopzer.chen@mediatek.com> In-Reply-To: From: Sami Tolvanen Date: Mon, 5 Jul 2021 10:59:39 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] Kbuild: lto: add CONFIG_MAKE_VERSION To: Masahiro Yamada Cc: Lecopzer Chen , Nick Desaulniers , Kees Cook , 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 Sun, Jul 4, 2021 at 7:03 PM Masahiro Yamada wrote: > > 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. I feel like requiring a Make that's half a decade old for a feature that also requires a toolchain released last October ago isn't entirely unreasonable. That being said, if Masahiro prefers not to rely on the wildcard function's behavior here, which is a reasonable request, we could simply use the shell to test for the file's existence: diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 34d257653fb4..c6bd62f518ff 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -388,7 +388,7 @@ ifeq ($(CONFIG_LTO_CLANG) $(CONFIG_MODVERSIONS),y y) cmd_update_lto_symversions = \ rm -f $@.symversions \ $(foreach n, $(filter-out FORCE,$^), \ - $(if $(wildcard $(n).symversions), \ + $(if $(shell test -s $(n).symversions && echo y), \ ; cat $(n).symversions >> $@.symversions)) else cmd_update_lto_symversions = echo >/dev/null This is not quite as efficient as using wildcard, but should work with older Make versions too. Thoughts? Sami