From patchwork Fri Feb 16 18:38:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 128615 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp866039ljc; Fri, 16 Feb 2018 10:43:46 -0800 (PST) X-Google-Smtp-Source: AH8x226aPeg1mlzoS1SpabEGV4TIDT1riQtBIPFs5R9BYLlgHkYEdYuFbsTxaDW0faSUPfoskjfV X-Received: by 10.99.8.4 with SMTP id 4mr5893403pgi.289.1518806625901; Fri, 16 Feb 2018 10:43:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518806625; cv=none; d=google.com; s=arc-20160816; b=jl2sCDUXJck6rHjhcWDWiJUu8uKWwfl2CjFfgpecAQMC3416lNLS5uIrvWkRVUqAsU hzFyUpHDwXAlwvrDvOaDjxOIpLV2wfVGz0zh1mOOeiE+s29eHAhN8OsG/ajk6X73XiKk s6u33Sboxvg1zZDcAiGJiF3QJtliWKtcPRzya1WKgkmF6ShWWmzCz4UdXGWpf7xHSOVk 30Cl6DZpD99Iz+Oulv5QNuU2pw5NixhN9GwRgvBpIbGPXQ9K35oOHggB+g0Nlo+KsO7k vR+Nfthf3iV/QGbag7sKvvgl6ncqUNOcqgnMBp40tggsdYN2DYMmt/A2tnlMLauaW4Sl BBqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=079cRTw+jGFXeq0pb+mxnY6zuhGGWvR5yrFHJc3DdNU=; b=sVbkef9uDbT7hev9cBqg/sPHCINMgKj9DtS0dTgGN6riHvJAW03YM3EU0ChubwsoOi 5vuV6GEbrArKzeL+T/JUvAA7kLMCqVKREU5x2VBBDfe6xMCFaPr9RfzNTqiEruCufKMw QnGLj9GLVw+Kgnh+X+SDVQWeELF3x6VWmSkTf3JqsV6Ier0eu6yjJoKLC/Do3031+FPD bmuQzYJHxomjdosj0arXwDkCsm4ZYFd3Bp5BpOJes4KmIRiZH5T8pICpJu8m0UkRpQwV /LryVfGV6nwR0zLC9eJbyiOFX77SKJlu9L1d4QNNXd0NP9cDXsOWwklv0kgehiv1dl04 lhBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=LNWb7/mc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5-v6si1643007plj.659.2018.02.16.10.43.45; Fri, 16 Feb 2018 10:43:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=LNWb7/mc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753552AbeBPSnm (ORCPT + 28 others); Fri, 16 Feb 2018 13:43:42 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:60059 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbeBPSnj (ORCPT ); Fri, 16 Feb 2018 13:43:39 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w1GIdBT3013418; Sat, 17 Feb 2018 03:39:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w1GIdBT3013418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1518806353; bh=079cRTw+jGFXeq0pb+mxnY6zuhGGWvR5yrFHJc3DdNU=; h=From:To:Cc:Subject:Date:From; b=LNWb7/mcCRcljhEh2cYJD4MGshPWIkiibqm9D6sVxc3+RBP8Qg3eiGW/1Bak67EUF qDF4G19ip0w/Kl6sGKfxffwZHFa7eRP4+wziIieEpCK0gpudJHx13daSTPv0dj0SPz 1drLYMYmsaPhEWKvCqwd+9K3SkfcsnBNLO5VU2H1l8aOyqE4td5dUoCkn+4J5YCp2D gDwSy+NDayRanyrZbunozPKBRPkQNzy0wtQnxDdlgsiT9x+9lR/b3KFmsrbAvQiJft wyuVeFwuSKuln1gBBDdzJa3VepGvBxf8zXd2voQWebDI4vz1enyjcIYqse+p0VI/9E pcrzxK8lwx0mQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org, Linus Torvalds Cc: Greg Kroah-Hartman , Arnd Bergmann , Kees Cook , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Michal Marek , Masahiro Yamada , Peter Oberparleiter , kernel-hardening@lists.openwall.com, Jonathan Corbet , sparclinux@vger.kernel.org, linux-sh@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Rich Felker , Jeff Dike , "H. Peter Anvin" , user-mode-linux-devel@lists.sourceforge.net, Yoshinori Sato , Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, Paul Mackerras , user-mode-linux-user@lists.sourceforge.net, Ingo Molnar , "David S. Miller" , Michael Ellerman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Weinberger , Emese Revfy Subject: [PATCH 00/23] kconfig: move compiler capability tests to Kconfig Date: Sat, 17 Feb 2018 03:38:28 +0900 Message-Id: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I brushed up the implementation in this version. In the previous RFC, CC_HAS_ was described by using 'option shell=', like this: config CC_HAS_STACKPROTECTOR bool option shell="$CC -Werror -fstack-protector -c -x c /dev/null" After I thought a bit more, the following syntax is more grammatical, and flexible. config CC_HAS_STACKPROTECTOR bool default $(shell $CC -Werror -fstack-protector -c -x c /dev/null) This version supports cc-option, so it can be written as: config CC_HAS_STACKPROTECTOR bool default $(cc-option -fstack-protector) To support this in a clean way, I introduced a new concept 'function' like we see in Makefiles. $(shell ...) is a built-in function. $(cc-option ...) is implemented as macro (user-defined function). I also try cleaning of stack-protector, gcc-plugins since the Makefile is so dirty. Current limitations: Dependency on outside scripts. For example, scripts/gcc-x86_64-has-stack-protecter.sh is run from Kconfig. When the shell script is updated, should Kconfig be re-run automatically? Inter-option dependency: $(call cc-option,...) in Makefile accumulates added options to KBUILD_CFLAGS, but it is difficult to do it in Kconfig. If a compiler option check is dependent on another option, this is a difficult case. Let's see how significant it is. Functions are evaluated statically: Functions are only expanded when parsing the Kconfig. So, it can not refelect user configuration. If this is required, $(shell ) must be dynamically re-calculated depending on other symbols. But, this is difficult, and may cause performance issue. Masahiro Yamada (22): kbuild: remove kbuild cache kbuild: remove CONFIG_CROSS_COMPILE support kconfig: add xstrdup() helper kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list kconfig: move and rename sym_expand_string_value() kconfig: reference environments directly and remove 'option env=' syntax kconfig: add function support and implement 'shell' function kconfig: add 'macro' keyword to support user-defined function kconfig: add 'cc-option' macro stack-protector: test compiler capability in Kconfig and drop AUTO mode kconfig: add 'shell-stdout' function kconfig: replace $UNAME_RELEASE with function call kconfig: expand environments/functions in (main)menu, comment, prompt kconfig: show compiler version text in the top comment kconfig: add CC_IS_GCC and GCC_VERSION kconfig: add CC_IS_CLANG and CLANG_VERSION gcov: remove CONFIG_GCOV_FORMAT_AUTODETECT kcov: imply GCC_PLUGINS and GCC_PLUGIN_SANCOV instead of select'ing them gcc-plugins: always build plugins with C++ gcc-plugins: move GCC version check for PowerPC to Kconfig gcc-plugins: test GCC plugin support in Kconfig gcc-plugins: enable GCC_PLUGINS for COMPILE_TEST Sami Tolvanen (1): kbuild: add clang-version.sh Documentation/kbuild/kconfig-language.txt | 8 - Kconfig | 4 +- Makefile | 103 ++---------- arch/Kconfig | 43 +++-- arch/powerpc/Kconfig | 2 +- arch/sh/Kconfig | 4 +- arch/sparc/Kconfig | 4 +- arch/tile/Kconfig | 2 +- arch/um/Kconfig.common | 4 - arch/x86/Kconfig | 12 +- arch/x86/um/Kconfig | 4 +- init/Kconfig | 44 +++--- kernel/gcov/Kconfig | 18 +-- kernel/gcov/Makefile | 2 - lib/Kconfig.debug | 7 +- scripts/Kbuild.include | 101 ++---------- scripts/Makefile.gcc-plugins | 95 ++++------- scripts/clang-version.sh | 31 ++++ scripts/gcc-plugin.sh | 37 +---- scripts/gcc-plugins/Makefile | 15 +- scripts/gcc-x86_32-has-stack-protector.sh | 7 +- scripts/gcc-x86_64-has-stack-protector.sh | 5 - scripts/kconfig/confdata.c | 33 +--- scripts/kconfig/function.c | 251 ++++++++++++++++++++++++++++++ scripts/kconfig/kconf_id.c | 2 +- scripts/kconfig/kxgettext.c | 2 +- scripts/kconfig/lkc.h | 6 +- scripts/kconfig/lkc_proto.h | 7 +- scripts/kconfig/menu.c | 6 +- scripts/kconfig/symbol.c | 139 +++-------------- scripts/kconfig/util.c | 186 ++++++++++++++++++++-- scripts/kconfig/zconf.l | 40 ++++- scripts/kconfig/zconf.y | 48 +++--- 33 files changed, 687 insertions(+), 585 deletions(-) create mode 100755 scripts/clang-version.sh create mode 100644 scripts/kconfig/function.c -- 2.7.4