[lkml]   [2018]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 19/30] kconfig: show compiler version text in the top comment
The kernel configuration phase is now tightly coupled with the compiler
in use. It will be nice to show the compiler information in Kconfig.

The compiler information will be displayed like this:

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- config
scripts/kconfig/conf --oldaskconfig Kconfig
* Linux/arm64 4.16.0-rc1 Kernel Configuration
* Compiler: aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011
* General setup
Compile also drivers which will not load (COMPILE_TEST) [N/y/?]

If you use GUI methods such as menuconfig, it will be displayed in the
top menu.

This is simply implemented by using the 'comment' statement. So, it
will be saved into the .config file as well.

This commit has a very important meaning. If the compiler is upgraded,
Kconfig must be re-run since different compilers have different sets
of supported options.

All referenced environments are written to include/config/auto.conf.cmd
so that any environment change triggers syncconfig, and prompt the user
to input new values if needed.

With this commit, something like follows will be added to

ifneq "$(CC_VERSION_TEXT)" "aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011"
include/config/auto.conf: FORCE

Signed-off-by: Masahiro Yamada <>
Reviewed-by: Kees Cook <>

Changes in v3: None
Changes in v2: None

Kconfig | 2 ++
Makefile | 2 ++
2 files changed, 4 insertions(+)

diff --git a/Kconfig b/Kconfig
index 4af1b42..5b55d87 100644
--- a/Kconfig
+++ b/Kconfig
@@ -5,4 +5,6 @@
mainmenu "Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration"

+comment "Compiler: $(CC_VERSION_TEXT)"
source "arch/$(SRCARCH)/Kconfig"
diff --git a/Makefile b/Makefile
index ca3e3e8..4b36329 100644
--- a/Makefile
+++ b/Makefile

+export CC_VERSION_TEXT := $(shell $(CC) --version | head -n 1)
# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
# even be read-only.
 \ /
  Last update: 2018-04-13 07:14    [W:0.786 / U:1.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site