linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/23] kconfig: move compiler capability tests to Kconfig
@ 2018-02-16 18:38 Masahiro Yamada
  2018-02-16 18:38 ` [PATCH 01/23] kbuild: remove kbuild cache Masahiro Yamada
                   ` (23 more replies)
  0 siblings, 24 replies; 64+ messages in thread
From: Masahiro Yamada @ 2018-02-16 18:38 UTC (permalink / raw)
  To: linux-kbuild, Linus Torvalds
  Cc: Greg Kroah-Hartman, Arnd Bergmann, Kees Cook, Randy Dunlap,
	Ulf Magnusson, Sam Ravnborg, Michal Marek, Masahiro Yamada,
	Peter Oberparleiter, kernel-hardening, Jonathan Corbet,
	sparclinux, linux-sh, x86, Thomas Gleixner, Rich Felker,
	Jeff Dike, H. Peter Anvin, user-mode-linux-devel, Yoshinori Sato,
	Benjamin Herrenschmidt, linuxppc-dev, Paul Mackerras,
	user-mode-linux-user, Ingo Molnar, David S. Miller,
	Michael Ellerman, linux-doc, linux-kernel, Richard Weinberger,
	Emese Revfy

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2018-03-02  9:12 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-16 18:38 [PATCH 00/23] kconfig: move compiler capability tests to Kconfig Masahiro Yamada
2018-02-16 18:38 ` [PATCH 01/23] kbuild: remove kbuild cache Masahiro Yamada
2018-02-16 18:38 ` [PATCH 02/23] kbuild: remove CONFIG_CROSS_COMPILE support Masahiro Yamada
2018-02-16 18:38 ` [PATCH 03/23] kconfig: add xstrdup() helper Masahiro Yamada
2018-03-01 15:02   ` Masahiro Yamada
2018-02-16 18:38 ` [PATCH 04/23] kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list Masahiro Yamada
2018-03-01 15:05   ` Masahiro Yamada
2018-03-01 17:11     ` Ulf Magnusson
2018-02-16 18:38 ` [PATCH 05/23] kconfig: move and rename sym_expand_string_value() Masahiro Yamada
2018-02-16 18:38 ` [PATCH 06/23] kconfig: reference environments directly and remove 'option env=' syntax Masahiro Yamada
2018-02-18 11:15   ` Ulf Magnusson
2018-02-16 18:38 ` [PATCH 07/23] kconfig: add function support and implement 'shell' function Masahiro Yamada
2018-02-17 16:16   ` Ulf Magnusson
2018-02-19 15:57     ` Masahiro Yamada
2018-02-19 17:50       ` Ulf Magnusson
2018-02-19 20:06         ` Ulf Magnusson
2018-02-19 22:06           ` Ulf Magnusson
2018-02-16 18:38 ` [PATCH 08/23] kconfig: add 'macro' keyword to support user-defined function Masahiro Yamada
2018-02-16 19:49   ` Nicolas Pitre
2018-02-16 23:51     ` Ulf Magnusson
2018-02-17  2:30       ` Nicolas Pitre
2018-02-17  4:29         ` Ulf Magnusson
2018-02-17  4:44           ` Nicolas Pitre
2018-02-17  6:06             ` Ulf Magnusson
2018-02-16 18:38 ` [PATCH 09/23] kconfig: add 'cc-option' macro Masahiro Yamada
2018-02-16 18:38 ` [PATCH 10/23] stack-protector: test compiler capability in Kconfig and drop AUTO mode Masahiro Yamada
2018-02-21  4:39   ` Masahiro Yamada
2018-02-16 18:38 ` [PATCH 11/23] kconfig: add 'shell-stdout' function Masahiro Yamada
2018-02-16 19:17   ` Linus Torvalds
2018-02-19  4:48     ` Ulf Magnusson
2018-02-19 17:44       ` Linus Torvalds
2018-02-19 18:01         ` Linus Torvalds
2018-02-19 18:54           ` Ulf Magnusson
2018-02-21  4:59           ` Masahiro Yamada
2018-02-21 16:41             ` Ulf Magnusson
2018-02-21 17:01             ` Linus Torvalds
2018-02-16 18:38 ` [PATCH 12/23] kconfig: replace $UNAME_RELEASE with function call Masahiro Yamada
2018-02-16 18:38 ` [PATCH 13/23] kconfig: expand environments/functions in (main)menu, comment, prompt Masahiro Yamada
2018-02-16 18:38 ` [PATCH 14/23] kconfig: show compiler version text in the top comment Masahiro Yamada
2018-02-16 18:38 ` [PATCH 15/23] kconfig: add CC_IS_GCC and GCC_VERSION Masahiro Yamada
2018-02-16 18:38 ` [PATCH 16/23] kbuild: add clang-version.sh Masahiro Yamada
2018-02-16 18:38 ` [PATCH 17/23] kconfig: add CC_IS_CLANG and CLANG_VERSION Masahiro Yamada
2018-02-16 18:38 ` [PATCH 18/23] gcov: remove CONFIG_GCOV_FORMAT_AUTODETECT Masahiro Yamada
2018-02-16 18:38 ` [PATCH 19/23] kcov: imply GCC_PLUGINS and GCC_PLUGIN_SANCOV instead of select'ing them Masahiro Yamada
2018-02-16 18:38 ` [PATCH 20/23] gcc-plugins: always build plugins with C++ Masahiro Yamada
2018-02-22 18:45   ` Emese Revfy
2018-02-23 12:37     ` Masahiro Yamada
2018-02-16 18:38 ` [PATCH 21/23] gcc-plugins: move GCC version check for PowerPC to Kconfig Masahiro Yamada
2018-02-22  5:04   ` Andrew Donnellan
2018-02-16 18:38 ` [PATCH 22/23] gcc-plugins: test GCC plugin support in Kconfig Masahiro Yamada
2018-02-16 18:38 ` [PATCH 23/23] gcc-plugins: enable GCC_PLUGINS for COMPILE_TEST Masahiro Yamada
2018-02-18 22:13 ` [PATCH 00/23] kconfig: move compiler capability tests to Kconfig Sam Ravnborg
2018-02-19 15:18   ` Ulf Magnusson
2018-02-21  7:38     ` Masahiro Yamada
2018-02-21  9:56       ` Arnd Bergmann
2018-02-21 10:20         ` Masahiro Yamada
2018-02-21 10:52           ` Arnd Bergmann
2018-02-21 12:57             ` Masahiro Yamada
2018-02-21 16:03               ` Arnd Bergmann
2018-02-21 21:39               ` Ulf Magnusson
2018-03-02  5:50                 ` Masahiro Yamada
2018-03-02  9:03                   ` Ulf Magnusson
2018-03-02  9:12                     ` Ulf Magnusson
2018-02-22  3:22               ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).