xen: Kconfig update with few extra
cover xen: Kconfig update with few extra
Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-system-xen-kconfig-v1
Hi,
This is a update of Kconfig as used to build the hypervisor. This is also in preparation of using Kbuild. The first version of the series, with a POC of using Kbuild to build xen can be found here:
https://lists.xenproject.org/archives/html/xen-devel/2019-10/msg01609.html
There's also some cleanup patches.
It has been suggested to me that Kconfig's new capability could be used to generate CFLAGS. I'm not sure how, but I've already added some patches where having CONFIG_* was already used.
New features of Kconfig:
- Can run shell commands!
This could be use to generate the CFLAGS and cleanup the Kconfig files to not have to depends on some env var (like XEN_HAS_BUILD_ID).
- Update to the graphical menuconfig, xconfig. It's now built with Qt4/Qt5.
- Probably others that I forgot.
This whole series should be "no functionality changes", I think.
Cheers,
Anthony PERARD (8):
Config.mk: Remove unused setvar_dir macro
Config.mk: Remove stray comment
xen: Update Kconfig to Linux v5.4
xen: Have Kconfig check $(CC)'s version
xen: Import cc-ifversion from Kbuild
xen: Move CONFIG_INDIRECT_THUNK to Kconfig
xen: Use $(CONFIG_CC_IS_CLANG) instead of $(clang) in Makefile
xen: Move GCC_HAS_VISIBILITY_ATTRIBUTE to Kconfig and common
Config.mk | 19 -
docs/misc/distro_mapping.txt | 5 +-
docs/misc/kconfig-language.rst | 701 +++++
docs/misc/kconfig-language.txt | 395 ---
docs/misc/kconfig-macro-language.rst | 247 ++
docs/misc/{kconfig.txt => kconfig.rst} | 185 +-
xen/.gitignore | 2 +
xen/Kconfig | 35 +-
xen/Makefile | 5 +-
xen/Rules.mk | 9 +-
xen/arch/arm/Kconfig | 2 +-
xen/arch/arm/Rules.mk | 4 -
xen/arch/x86/Kconfig | 3 +
xen/arch/x86/Rules.mk | 11 +-
xen/common/Kconfig | 12 +-
xen/common/coverage/Makefile | 10 +-
xen/include/Makefile | 2 +-
xen/include/xen/compiler.h | 2 +-
xen/scripts/Kbuild.include | 7 +
xen/scripts/Kconfig.include | 39 +
xen/scripts/clang-version.sh | 19 +
xen/scripts/gcc-version.sh | 20 +
xen/tools/kconfig/.gitignore | 6 +-
xen/tools/kconfig/Makefile | 268 +-
xen/tools/kconfig/Makefile.host | 121 +-
xen/tools/kconfig/Makefile.kconfig | 52 +-
xen/tools/kconfig/conf.c | 191 +-
xen/tools/kconfig/confdata.c | 491 ++--
xen/tools/kconfig/expr.c | 213 +-
xen/tools/kconfig/expr.h | 108 +-
xen/tools/kconfig/gconf-cfg.sh | 30 +
xen/tools/kconfig/gconf.c | 39 +-
xen/tools/kconfig/images.c | 34 +-
xen/tools/kconfig/images.h | 33 +
xen/tools/kconfig/lexer.l | 471 +++
xen/tools/kconfig/list.h | 1 +
xen/tools/kconfig/lkc.h | 38 +-
xen/tools/kconfig/lkc_proto.h | 21 +-
xen/tools/kconfig/lxdialog/.gitignore | 4 -
xen/tools/kconfig/lxdialog/BIG.FAT.WARNING | 2 +-
xen/tools/kconfig/lxdialog/check-lxdialog.sh | 91 -
xen/tools/kconfig/lxdialog/checklist.c | 15 +-
xen/tools/kconfig/lxdialog/dialog.h | 17 +-
xen/tools/kconfig/lxdialog/inputbox.c | 18 +-
xen/tools/kconfig/lxdialog/menubox.c | 15 +-
xen/tools/kconfig/lxdialog/textbox.c | 15 +-
xen/tools/kconfig/lxdialog/util.c | 15 +-
xen/tools/kconfig/lxdialog/yesno.c | 15 +-
xen/tools/kconfig/mconf-cfg.sh | 47 +
xen/tools/kconfig/mconf.c | 27 +-
xen/tools/kconfig/menu.c | 288 +-
xen/tools/kconfig/merge_config.sh | 87 +-
xen/tools/kconfig/nconf-cfg.sh | 47 +
xen/tools/kconfig/nconf.c | 42 +-
xen/tools/kconfig/nconf.gui.c | 30 +-
xen/tools/kconfig/nconf.h | 9 +-
xen/tools/kconfig/{zconf.y => parser.y} | 409 ++-
xen/tools/kconfig/preprocess.c | 574 ++++
xen/tools/kconfig/qconf-cfg.sh | 32 +
xen/tools/kconfig/qconf.cc | 750 +++--
xen/tools/kconfig/qconf.h | 153 +-
xen/tools/kconfig/streamline_config.pl | 53 +-
xen/tools/kconfig/symbol.c | 295 +-
xen/tools/kconfig/tests/auto_submenu/Kconfig | 52 +
.../kconfig/tests/auto_submenu/__init__.py | 13 +
.../tests/auto_submenu/expected_stdout | 10 +
xen/tools/kconfig/tests/choice/Kconfig | 56 +
xen/tools/kconfig/tests/choice/__init__.py | 41 +
.../tests/choice/alldef_expected_config | 5 +
.../tests/choice/allmod_expected_config | 9 +
.../tests/choice/allno_expected_config | 5 +
.../tests/choice/allyes_expected_config | 9 +
.../tests/choice/oldask0_expected_stdout | 10 +
xen/tools/kconfig/tests/choice/oldask1_config | 2 +
.../tests/choice/oldask1_expected_stdout | 15 +
.../tests/choice_value_with_m_dep/Kconfig | 21 +
.../tests/choice_value_with_m_dep/__init__.py | 16 +
.../tests/choice_value_with_m_dep/config | 2 +
.../choice_value_with_m_dep/expected_config | 3 +
.../choice_value_with_m_dep/expected_stdout | 4 +
xen/tools/kconfig/tests/conftest.py | 291 ++
.../kconfig/tests/err_recursive_dep/Kconfig | 63 +
.../tests/err_recursive_dep/__init__.py | 10 +
.../tests/err_recursive_dep/expected_stderr | 38 +
.../kconfig/tests/err_recursive_inc/Kconfig | 2 +
.../tests/err_recursive_inc/Kconfig.inc1 | 5 +
.../tests/err_recursive_inc/Kconfig.inc2 | 4 +
.../tests/err_recursive_inc/Kconfig.inc3 | 2 +
.../tests/err_recursive_inc/__init__.py | 11 +
.../tests/err_recursive_inc/expected_stderr | 6 +
xen/tools/kconfig/tests/inter_choice/Kconfig | 25 +
.../kconfig/tests/inter_choice/__init__.py | 15 +
.../kconfig/tests/inter_choice/defconfig | 1 +
.../tests/inter_choice/expected_config | 4 +
.../kconfig/tests/new_choice_with_dep/Kconfig | 39 +
.../tests/new_choice_with_dep/__init__.py | 15 +
.../kconfig/tests/new_choice_with_dep/config | 3 +
.../tests/new_choice_with_dep/expected_stdout | 10 +
.../tests/no_write_if_dep_unmet/Kconfig | 16 +
.../tests/no_write_if_dep_unmet/__init__.py | 20 +
.../tests/no_write_if_dep_unmet/config | 1 +
.../no_write_if_dep_unmet/expected_config | 5 +
.../tests/preprocess/builtin_func/Kconfig | 27 +
.../tests/preprocess/builtin_func/__init__.py | 9 +
.../preprocess/builtin_func/expected_stderr | 5 +
.../preprocess/builtin_func/expected_stdout | 1 +
.../preprocess/circular_expansion/Kconfig | 5 +
.../preprocess/circular_expansion/__init__.py | 11 +
.../circular_expansion/expected_stderr | 1 +
.../kconfig/tests/preprocess/escape/Kconfig | 44 +
.../tests/preprocess/escape/__init__.py | 8 +
.../tests/preprocess/escape/expected_stderr | 10 +
.../kconfig/tests/preprocess/variable/Kconfig | 53 +
.../tests/preprocess/variable/__init__.py | 8 +
.../tests/preprocess/variable/expected_stderr | 9 +
xen/tools/kconfig/tests/pytest.ini | 7 +
.../kconfig/tests/rand_nested_choice/Kconfig | 35 +
.../tests/rand_nested_choice/__init__.py | 17 +
.../tests/rand_nested_choice/expected_stdout0 | 2 +
.../tests/rand_nested_choice/expected_stdout1 | 4 +
.../tests/rand_nested_choice/expected_stdout2 | 5 +
xen/tools/kconfig/util.c | 86 +-
xen/tools/kconfig/zconf.gperf | 49 -
xen/tools/kconfig/zconf.hash.c_shipped | 293 --
xen/tools/kconfig/zconf.l | 374 ---
xen/tools/kconfig/zconf.lex.c_shipped | 2473 ----------------
xen/tools/kconfig/zconf.tab.c_shipped | 2580 -----------------
127 files changed, 5763 insertions(+), 8113 deletions(-)
create mode 100644 docs/misc/kconfig-language.rst
delete mode 100644 docs/misc/kconfig-language.txt
create mode 100644 docs/misc/kconfig-macro-language.rst
rename docs/misc/{kconfig.txt => kconfig.rst} (70%)
create mode 100644 xen/.gitignore
create mode 100644 xen/scripts/Kbuild.include
create mode 100644 xen/scripts/Kconfig.include
create mode 100755 xen/scripts/clang-version.sh
create mode 100755 xen/scripts/gcc-version.sh
create mode 100755 xen/tools/kconfig/gconf-cfg.sh
create mode 100644 xen/tools/kconfig/images.h
create mode 100644 xen/tools/kconfig/lexer.l
delete mode 100644 xen/tools/kconfig/lxdialog/.gitignore
delete mode 100755 xen/tools/kconfig/lxdialog/check-lxdialog.sh
create mode 100755 xen/tools/kconfig/mconf-cfg.sh
create mode 100755 xen/tools/kconfig/nconf-cfg.sh
rename xen/tools/kconfig/{zconf.y => parser.y} (66%)
create mode 100644 xen/tools/kconfig/preprocess.c
create mode 100755 xen/tools/kconfig/qconf-cfg.sh
create mode 100644 xen/tools/kconfig/tests/auto_submenu/Kconfig
create mode 100644 xen/tools/kconfig/tests/auto_submenu/__init__.py
create mode 100644 xen/tools/kconfig/tests/auto_submenu/expected_stdout
create mode 100644 xen/tools/kconfig/tests/choice/Kconfig
create mode 100644 xen/tools/kconfig/tests/choice/__init__.py
create mode 100644 xen/tools/kconfig/tests/choice/alldef_expected_config
create mode 100644 xen/tools/kconfig/tests/choice/allmod_expected_config
create mode 100644 xen/tools/kconfig/tests/choice/allno_expected_config
create mode 100644 xen/tools/kconfig/tests/choice/allyes_expected_config
create mode 100644 xen/tools/kconfig/tests/choice/oldask0_expected_stdout
create mode 100644 xen/tools/kconfig/tests/choice/oldask1_config
create mode 100644 xen/tools/kconfig/tests/choice/oldask1_expected_stdout
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/Kconfig
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/__init__.py
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/config
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/expected_config
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/expected_stdout
create mode 100644 xen/tools/kconfig/tests/conftest.py
create mode 100644 xen/tools/kconfig/tests/err_recursive_dep/Kconfig
create mode 100644 xen/tools/kconfig/tests/err_recursive_dep/__init__.py
create mode 100644 xen/tools/kconfig/tests/err_recursive_dep/expected_stderr
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/Kconfig
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/Kconfig.inc1
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/Kconfig.inc2
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/Kconfig.inc3
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/__init__.py
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/expected_stderr
create mode 100644 xen/tools/kconfig/tests/inter_choice/Kconfig
create mode 100644 xen/tools/kconfig/tests/inter_choice/__init__.py
create mode 100644 xen/tools/kconfig/tests/inter_choice/defconfig
create mode 100644 xen/tools/kconfig/tests/inter_choice/expected_config
create mode 100644 xen/tools/kconfig/tests/new_choice_with_dep/Kconfig
create mode 100644 xen/tools/kconfig/tests/new_choice_with_dep/__init__.py
create mode 100644 xen/tools/kconfig/tests/new_choice_with_dep/config
create mode 100644 xen/tools/kconfig/tests/new_choice_with_dep/expected_stdout
create mode 100644 xen/tools/kconfig/tests/no_write_if_dep_unmet/Kconfig
create mode 100644 xen/tools/kconfig/tests/no_write_if_dep_unmet/__init__.py
create mode 100644 xen/tools/kconfig/tests/no_write_if_dep_unmet/config
create mode 100644 xen/tools/kconfig/tests/no_write_if_dep_unmet/expected_config
create mode 100644 xen/tools/kconfig/tests/preprocess/builtin_func/Kconfig
create mode 100644 xen/tools/kconfig/tests/preprocess/builtin_func/__init__.py
create mode 100644 xen/tools/kconfig/tests/preprocess/builtin_func/expected_stderr
create mode 100644 xen/tools/kconfig/tests/preprocess/builtin_func/expected_stdout
create mode 100644 xen/tools/kconfig/tests/preprocess/circular_expansion/Kconfig
create mode 100644 xen/tools/kconfig/tests/preprocess/circular_expansion/__init__.py
create mode 100644 xen/tools/kconfig/tests/preprocess/circular_expansion/expected_stderr
create mode 100644 xen/tools/kconfig/tests/preprocess/escape/Kconfig
create mode 100644 xen/tools/kconfig/tests/preprocess/escape/__init__.py
create mode 100644 xen/tools/kconfig/tests/preprocess/escape/expected_stderr
create mode 100644 xen/tools/kconfig/tests/preprocess/variable/Kconfig
create mode 100644 xen/tools/kconfig/tests/preprocess/variable/__init__.py
create mode 100644 xen/tools/kconfig/tests/preprocess/variable/expected_stderr
create mode 100644 xen/tools/kconfig/tests/pytest.ini
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/Kconfig
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/__init__.py
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/expected_stdout0
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/expected_stdout1
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/expected_stdout2
delete mode 100644 xen/tools/kconfig/zconf.gperf
delete mode 100644 xen/tools/kconfig/zconf.hash.c_shipped
delete mode 100644 xen/tools/kconfig/zconf.l
delete mode 100644 xen/tools/kconfig/zconf.lex.c_shipped
delete mode 100644 xen/tools/kconfig/zconf.tab.c_shippedSignature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 1/8 Config.mk: Remove unused setvar_dir macro
And remove all mention of it in docs. It hasn't been used since 9ead9afcb935 ("Add configure --with-sysconfig-leaf-dir=SUBDIR to set CONFIG_LEAF_DIR").
--- Config.mk | 11 ----------- docs/misc/distro_mapping.txt | 5 ++--- 2 files changed, 2 insertions(+), 14 deletions(-)
Config.mk +0 -11
@@ -68,17 +68,6 @@ DEPS_RM = $(DEPS) $(DEPS_INCLUDE) include $(XEN_ROOT)/config/$(XEN_OS).mk include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk -# arguments: variable, common path part, path to test, if yes, if no -define setvar_dir - ifndef $(1) - ifneq (,$(wildcard $(2)$(3))) - $(1) ?= $(2)$(4) - else - $(1) ?= $(2)$(5) - endif - endif -endef - ifneq ($(EXTRA_PREFIX),) EXTRA_INCLUDES += $(EXTRA_PREFIX)/include EXTRA_LIB += $(EXTRA_PREFIX)/lib
docs/misc/distro_mapping.txt +2 -3
@@ -9,9 +9,8 @@ INITD_DIR | /etc/rc.d/init.d | /etc/init.d | /etc/init.d | -----------------+------------------+---------------+----------------+ The existence of these directories are tested at build-time (on the -build host, via the "setvar_dir" macro in Config.mk) and for some -scripts at run-time. If the Red Hat directory exists, it is used; -otherwise the Debian one is used. +build host) and for some scripts at run-time. If the Red Hat +directory exists, it is used; otherwise the Debian one is used. The INITD_DIR path can be changed with configure --with-initddir=DIR. The CONFIG_LEAF_DIR name can be changed with configure
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 1/8] Config.mk: Remove unused setvar_dir macro
Quoted 5 lines · Anthony PERARD
And remove all mention of it in docs. It hasn't been used since
9ead9afcb935("Add configure --with-sysconfig-leaf-dir=SUBDIR to setCONFIG_LEAF_DIR").Signed-off-by Anthony PERARD <[email protected]>
docs/misc/distro_mapping.txt
Quoted 31 lines
--- Config.mk | 11 ----------- docs/misc/distro_mapping.txt | 5 ++--- 2 files changed, 2 insertions(+), 14 deletions(-)Config.mk +0
-11@@ -68,17 +68,6 @@ DEPS_RM = $(DEPS) $(DEPS_INCLUDE) include $(XEN_ROOT)/config/$(XEN_OS).mk include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk -# arguments: variable, common path part, path to test, if yes, if no -define setvar_dir - ifndef $(1) - ifneq (,$(wildcard $(2)$(3))) - $(1) ?= $(2)$(4) - else - $(1) ?= $(2)$(5) - endif - endif -endef - ifneq ($(EXTRA_PREFIX),) EXTRA_INCLUDES += $(EXTRA_PREFIX)/include EXTRA_LIB += $(EXTRA_PREFIX)/libdocs/misc/distro_mapping.txt +0
-0
It looks like this is entirely obsolete since we switched to using ./configure.
Mind if we expand the patch to kill this file fully? (Can be sorted on commit if you want.)
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 1/8] Config.mk: Remove unused setvar_dir macro
Quoted 11 lines · Andrew Cooper
docs/misc/distro_mapping.txt
Quoted 4 lines · Anthony PERARD
docs/misc/distro_mapping.txt +0
-0It looks like this is entirely obsolete since we switched to using ./configure.
Mind if we expand the patch to kill this file fully? (Can be sorted on commit if you want.)
I think it would be better to remove the file in a separated commit, with a proper explanation. Probably about half of the file is still true, I'm not sure about the other half. That document might not be relevant anymore, since hopefully ./configure --help is enough, but I haven't checked.
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/8 Config.mk: Remove stray comment
In reply to Anthony PERARDThis comment isn't about CONFIG_TESTS, but about SEABIOS_DIR that has been removed.
Originally, the comment was added by 5f82d0858de1 ("tools: support SeaBIOS. Use by default when upstream qemu is configured."), then later the SEABIOS_DIR was removed by 14ee3c05f3ef ("Clone and build Seabios by default") but that comment about the pain was left behind. The commit that made CONFIG_TESTS painful was 85896a7c4dc7 ("build:
add autoconf to replace custom checks in tools/check").
Let the comment rest, event if CONFIG_TESTS=y can be painful. It's enabled by default anyway and doesn't cause pain for most configuration.
--- Config.mk | 3 --- 1 file changed, 3 deletions(-)
Config.mk +0 -3
@@ -289,7 +289,4 @@ QEMU_TRADITIONAL_LOC ?= $(call or,$(wildcard $(QEMU_TRADITIONAL_INTREE)),\ QEMU_UPSTREAM_LOC ?= $(call or,$(wildcard $(QEMU_UPSTREAM_INTREE)),\ $(QEMU_UPSTREAM_URL)) -# Short answer -- do not enable this unless you know what you are -# doing and are prepared for some pain. - CONFIG_TESTS ?= y
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 2/8] Config.mk: Remove stray comment
Quoted 10 lines · Anthony PERARD
This comment isn't about
CONFIG_TESTS, but aboutSEABIOS_DIRthat has been removed.Originally, the comment was added by
5f82d0858de1("tools: support SeaBIOS. Use by default when upstream qemu is configured."), then later theSEABIOS_DIRwas removed by14ee3c05f3ef("Clone and build Seabios by default") but that comment about the pain was left behind. The commit that madeCONFIG_TESTSpainful was85896a7c4dc7("build:
add autoconf to replace custom checks intools/check").
Quoted 3 lines
Let the comment rest, event if
CONFIG_TESTS=ycan be painful. It's enabled by default anyway and doesn't cause pain for most configuration.
Do you mean "rest, even if"? Even if so, I'm afraid I still can't parse this paragraph.
The change itself looks fine and reasonable.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 2/8] Config.mk: Remove stray comment
Quoted 11 lines · Andrew Cooper
Quoted 10 lines · Anthony PERARD
This comment isn't about
CONFIG_TESTS, but aboutSEABIOS_DIRthat has been removed.Originally, the comment was added by
5f82d0858de1("tools: support SeaBIOS. Use by default when upstream qemu is configured."), then later theSEABIOS_DIRwas removed by14ee3c05f3ef("Clone and build Seabios by default") but that comment about the pain was left behind. The commit that madeCONFIG_TESTSpainful was85896a7c4dc7("build:
add autoconf to replace custom checks intools/check").
Quoted 6 lines
Quoted 3 lines
Let the comment rest, event if
CONFIG_TESTS=ycan be painful. It's enabled by default anyway and doesn't cause pain for most configuration.Do you mean "rest, even if"? Even if so, I'm afraid I still can't parse this paragraph.
That last paragraph could be remove I think. It is mostly prose which doesn't add much information. Some people may understand the reference.
When writing that last paragraph, I had that in mind:
https://lists.xenproject.org/archives/html/xen-devel/2019-11/msg01410.html
I though that was amusing, the way the comment was left behind and started to be understood as a comment for something else.
:-)
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 3/8 xen: Update Kconfig to Linux v5.4
In reply to Anthony PERARDThis patch updates Kconfig to a more recent version of Kconfig, found in Linux v5.4.0, 219d54332a09 ("Linux 5.4").
With the updated version of Kconfig, other changes are necessary to avoid breaking the build.
Kconfig files:
- fix Kconfig files that where using option env=*:
Since Linux commit 104daea149c4 ("kconfig: reference environment variables directly and remove 'option env='"), we can access the environment directly via $() and "option env=" as been removed.
- CONFIG_EXPERT='y' will now appear in .config file if XEN_CONFIG_EXPERT=y in the environment. The alternative is to change "EXPERT" to "$(XEN_CONFIG_EXPERT)" in all Kconfig files.
Makefile:
- silentoldconfig target as been removed from Kconfig. To update include/generated/autoconf.h, we need to use syncconfig target instead.
Makefile.kconfig:
- Import newer needed code from Linux's Makefile.lib and Kbuild.include and Makefile.build.
- Set Q to empty, Xen build system doesn't silence commands. Having Q empty mean we can import stuff from Linux without having to remove the leading $(Q) from build commands. And quiet='' means commands will be echoed.
- Add $(PHONY) to .PHONY. Like it is intended by Kbuild.
Makefile.host is also updated and copied from Linux.
Dependency change:
- Now depends on flex/bison, maybe we could _shipped those files like before. Linux doesn't do that anymore.
---
docs/misc/kconfig-language.rst | 701 +++++
docs/misc/kconfig-language.txt | 395 ---
docs/misc/kconfig-macro-language.rst | 247 ++
docs/misc/{kconfig.txt => kconfig.rst} | 185 +-
xen/.gitignore | 2 +
xen/Kconfig | 18 +-
xen/Makefile | 4 +-
xen/arch/arm/Kconfig | 2 +-
xen/common/Kconfig | 12 +-
xen/tools/kconfig/.gitignore | 6 +-
xen/tools/kconfig/Makefile | 268 +-
xen/tools/kconfig/Makefile.host | 121 +-
xen/tools/kconfig/Makefile.kconfig | 52 +-
xen/tools/kconfig/conf.c | 191 +-
xen/tools/kconfig/confdata.c | 491 ++--
xen/tools/kconfig/expr.c | 213 +-
xen/tools/kconfig/expr.h | 108 +-
xen/tools/kconfig/gconf-cfg.sh | 30 +
xen/tools/kconfig/gconf.c | 39 +-
xen/tools/kconfig/images.c | 34 +-
xen/tools/kconfig/images.h | 33 +
xen/tools/kconfig/lexer.l | 471 +++
xen/tools/kconfig/list.h | 1 +
xen/tools/kconfig/lkc.h | 38 +-
xen/tools/kconfig/lkc_proto.h | 21 +-
xen/tools/kconfig/lxdialog/.gitignore | 4 -
xen/tools/kconfig/lxdialog/BIG.FAT.WARNING | 2 +-
xen/tools/kconfig/lxdialog/check-lxdialog.sh | 91 -
xen/tools/kconfig/lxdialog/checklist.c | 15 +-
xen/tools/kconfig/lxdialog/dialog.h | 17 +-
xen/tools/kconfig/lxdialog/inputbox.c | 18 +-
xen/tools/kconfig/lxdialog/menubox.c | 15 +-
xen/tools/kconfig/lxdialog/textbox.c | 15 +-
xen/tools/kconfig/lxdialog/util.c | 15 +-
xen/tools/kconfig/lxdialog/yesno.c | 15 +-
xen/tools/kconfig/mconf-cfg.sh | 47 +
xen/tools/kconfig/mconf.c | 27 +-
xen/tools/kconfig/menu.c | 288 +-
xen/tools/kconfig/merge_config.sh | 87 +-
xen/tools/kconfig/nconf-cfg.sh | 47 +
xen/tools/kconfig/nconf.c | 42 +-
xen/tools/kconfig/nconf.gui.c | 30 +-
xen/tools/kconfig/nconf.h | 9 +-
xen/tools/kconfig/{zconf.y => parser.y} | 409 ++-
xen/tools/kconfig/preprocess.c | 574 ++++
xen/tools/kconfig/qconf-cfg.sh | 32 +
xen/tools/kconfig/qconf.cc | 750 +++--
xen/tools/kconfig/qconf.h | 153 +-
xen/tools/kconfig/streamline_config.pl | 53 +-
xen/tools/kconfig/symbol.c | 295 +-
xen/tools/kconfig/tests/auto_submenu/Kconfig | 52 +
.../kconfig/tests/auto_submenu/__init__.py | 13 +
.../tests/auto_submenu/expected_stdout | 10 +
xen/tools/kconfig/tests/choice/Kconfig | 56 +
xen/tools/kconfig/tests/choice/__init__.py | 41 +
.../tests/choice/alldef_expected_config | 5 +
.../tests/choice/allmod_expected_config | 9 +
.../tests/choice/allno_expected_config | 5 +
.../tests/choice/allyes_expected_config | 9 +
.../tests/choice/oldask0_expected_stdout | 10 +
xen/tools/kconfig/tests/choice/oldask1_config | 2 +
.../tests/choice/oldask1_expected_stdout | 15 +
.../tests/choice_value_with_m_dep/Kconfig | 21 +
.../tests/choice_value_with_m_dep/__init__.py | 16 +
.../tests/choice_value_with_m_dep/config | 2 +
.../choice_value_with_m_dep/expected_config | 3 +
.../choice_value_with_m_dep/expected_stdout | 4 +
xen/tools/kconfig/tests/conftest.py | 291 ++
.../kconfig/tests/err_recursive_dep/Kconfig | 63 +
.../tests/err_recursive_dep/__init__.py | 10 +
.../tests/err_recursive_dep/expected_stderr | 38 +
.../kconfig/tests/err_recursive_inc/Kconfig | 2 +
.../tests/err_recursive_inc/Kconfig.inc1 | 5 +
.../tests/err_recursive_inc/Kconfig.inc2 | 4 +
.../tests/err_recursive_inc/Kconfig.inc3 | 2 +
.../tests/err_recursive_inc/__init__.py | 11 +
.../tests/err_recursive_inc/expected_stderr | 6 +
xen/tools/kconfig/tests/inter_choice/Kconfig | 25 +
.../kconfig/tests/inter_choice/__init__.py | 15 +
.../kconfig/tests/inter_choice/defconfig | 1 +
.../tests/inter_choice/expected_config | 4 +
.../kconfig/tests/new_choice_with_dep/Kconfig | 39 +
.../tests/new_choice_with_dep/__init__.py | 15 +
.../kconfig/tests/new_choice_with_dep/config | 3 +
.../tests/new_choice_with_dep/expected_stdout | 10 +
.../tests/no_write_if_dep_unmet/Kconfig | 16 +
.../tests/no_write_if_dep_unmet/__init__.py | 20 +
.../tests/no_write_if_dep_unmet/config | 1 +
.../no_write_if_dep_unmet/expected_config | 5 +
.../tests/preprocess/builtin_func/Kconfig | 27 +
.../tests/preprocess/builtin_func/__init__.py | 9 +
.../preprocess/builtin_func/expected_stderr | 5 +
.../preprocess/builtin_func/expected_stdout | 1 +
.../preprocess/circular_expansion/Kconfig | 5 +
.../preprocess/circular_expansion/__init__.py | 11 +
.../circular_expansion/expected_stderr | 1 +
.../kconfig/tests/preprocess/escape/Kconfig | 44 +
.../tests/preprocess/escape/__init__.py | 8 +
.../tests/preprocess/escape/expected_stderr | 10 +
.../kconfig/tests/preprocess/variable/Kconfig | 53 +
.../tests/preprocess/variable/__init__.py | 8 +
.../tests/preprocess/variable/expected_stderr | 9 +
xen/tools/kconfig/tests/pytest.ini | 7 +
.../kconfig/tests/rand_nested_choice/Kconfig | 35 +
.../tests/rand_nested_choice/__init__.py | 17 +
.../tests/rand_nested_choice/expected_stdout0 | 2 +
.../tests/rand_nested_choice/expected_stdout1 | 4 +
.../tests/rand_nested_choice/expected_stdout2 | 5 +
xen/tools/kconfig/util.c | 86 +-
xen/tools/kconfig/zconf.gperf | 49 -
xen/tools/kconfig/zconf.hash.c_shipped | 293 --
xen/tools/kconfig/zconf.l | 374 ---
xen/tools/kconfig/zconf.lex.c_shipped | 2473 ----------------
xen/tools/kconfig/zconf.tab.c_shipped | 2580 -----------------
114 files changed, 5639 insertions(+), 8069 deletions(-)
create mode 100644 docs/misc/kconfig-language.rst
delete mode 100644 docs/misc/kconfig-language.txt
create mode 100644 docs/misc/kconfig-macro-language.rst
rename docs/misc/{kconfig.txt => kconfig.rst} (70%)
create mode 100644 xen/.gitignore
create mode 100755 xen/tools/kconfig/gconf-cfg.sh
create mode 100644 xen/tools/kconfig/images.h
create mode 100644 xen/tools/kconfig/lexer.l
delete mode 100644 xen/tools/kconfig/lxdialog/.gitignore
delete mode 100755 xen/tools/kconfig/lxdialog/check-lxdialog.sh
create mode 100755 xen/tools/kconfig/mconf-cfg.sh
create mode 100755 xen/tools/kconfig/nconf-cfg.sh
rename xen/tools/kconfig/{zconf.y => parser.y} (66%)
create mode 100644 xen/tools/kconfig/preprocess.c
create mode 100755 xen/tools/kconfig/qconf-cfg.sh
create mode 100644 xen/tools/kconfig/tests/auto_submenu/Kconfig
create mode 100644 xen/tools/kconfig/tests/auto_submenu/__init__.py
create mode 100644 xen/tools/kconfig/tests/auto_submenu/expected_stdout
create mode 100644 xen/tools/kconfig/tests/choice/Kconfig
create mode 100644 xen/tools/kconfig/tests/choice/__init__.py
create mode 100644 xen/tools/kconfig/tests/choice/alldef_expected_config
create mode 100644 xen/tools/kconfig/tests/choice/allmod_expected_config
create mode 100644 xen/tools/kconfig/tests/choice/allno_expected_config
create mode 100644 xen/tools/kconfig/tests/choice/allyes_expected_config
create mode 100644 xen/tools/kconfig/tests/choice/oldask0_expected_stdout
create mode 100644 xen/tools/kconfig/tests/choice/oldask1_config
create mode 100644 xen/tools/kconfig/tests/choice/oldask1_expected_stdout
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/Kconfig
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/__init__.py
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/config
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/expected_config
create mode 100644 xen/tools/kconfig/tests/choice_value_with_m_dep/expected_stdout
create mode 100644 xen/tools/kconfig/tests/conftest.py
create mode 100644 xen/tools/kconfig/tests/err_recursive_dep/Kconfig
create mode 100644 xen/tools/kconfig/tests/err_recursive_dep/__init__.py
create mode 100644 xen/tools/kconfig/tests/err_recursive_dep/expected_stderr
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/Kconfig
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/Kconfig.inc1
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/Kconfig.inc2
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/Kconfig.inc3
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/__init__.py
create mode 100644 xen/tools/kconfig/tests/err_recursive_inc/expected_stderr
create mode 100644 xen/tools/kconfig/tests/inter_choice/Kconfig
create mode 100644 xen/tools/kconfig/tests/inter_choice/__init__.py
create mode 100644 xen/tools/kconfig/tests/inter_choice/defconfig
create mode 100644 xen/tools/kconfig/tests/inter_choice/expected_config
create mode 100644 xen/tools/kconfig/tests/new_choice_with_dep/Kconfig
create mode 100644 xen/tools/kconfig/tests/new_choice_with_dep/__init__.py
create mode 100644 xen/tools/kconfig/tests/new_choice_with_dep/config
create mode 100644 xen/tools/kconfig/tests/new_choice_with_dep/expected_stdout
create mode 100644 xen/tools/kconfig/tests/no_write_if_dep_unmet/Kconfig
create mode 100644 xen/tools/kconfig/tests/no_write_if_dep_unmet/__init__.py
create mode 100644 xen/tools/kconfig/tests/no_write_if_dep_unmet/config
create mode 100644 xen/tools/kconfig/tests/no_write_if_dep_unmet/expected_config
create mode 100644 xen/tools/kconfig/tests/preprocess/builtin_func/Kconfig
create mode 100644 xen/tools/kconfig/tests/preprocess/builtin_func/__init__.py
create mode 100644 xen/tools/kconfig/tests/preprocess/builtin_func/expected_stderr
create mode 100644 xen/tools/kconfig/tests/preprocess/builtin_func/expected_stdout
create mode 100644 xen/tools/kconfig/tests/preprocess/circular_expansion/Kconfig
create mode 100644 xen/tools/kconfig/tests/preprocess/circular_expansion/__init__.py
create mode 100644 xen/tools/kconfig/tests/preprocess/circular_expansion/expected_stderr
create mode 100644 xen/tools/kconfig/tests/preprocess/escape/Kconfig
create mode 100644 xen/tools/kconfig/tests/preprocess/escape/__init__.py
create mode 100644 xen/tools/kconfig/tests/preprocess/escape/expected_stderr
create mode 100644 xen/tools/kconfig/tests/preprocess/variable/Kconfig
create mode 100644 xen/tools/kconfig/tests/preprocess/variable/__init__.py
create mode 100644 xen/tools/kconfig/tests/preprocess/variable/expected_stderr
create mode 100644 xen/tools/kconfig/tests/pytest.ini
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/Kconfig
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/__init__.py
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/expected_stdout0
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/expected_stdout1
create mode 100644 xen/tools/kconfig/tests/rand_nested_choice/expected_stdout2
delete mode 100644 xen/tools/kconfig/zconf.gperf
delete mode 100644 xen/tools/kconfig/zconf.hash.c_shipped
delete mode 100644 xen/tools/kconfig/zconf.l
delete mode 100644 xen/tools/kconfig/zconf.lex.c_shipped
delete mode 100644 xen/tools/kconfig/zconf.tab.c_shippeddocs/misc/kconfig-language.rst new file +701 -0
@@ -0,0 +1,701 @@ +================ +Kconfig Language +================ + +Introduction +------------ + +The configuration database is a collection of configuration options +organized in a tree structure:: + + +- Code maturity level options + | +- Prompt for development and/or incomplete code/drivers + +- General setup + | +- Networking support + | +- System V IPC + | +- BSD Process Accounting + | +- Sysctl support + +- Loadable module support + | +- Enable loadable module support + | +- Set version information on all module symbols + | +- Kernel module loader + +- ... + +Every entry has its own dependencies. These dependencies are used +to determine the visibility of an entry. Any child entry is only +visible if its parent entry is also visible. + +Menu entries +------------ + +Most entries define a config option; all other entries help to organize +them. A single configuration option is defined like this:: + + config MODVERSIONS + bool "Set version information on all module symbols" + depends on MODULES + help + Usually, modules have to be recompiled whenever you switch to a new + kernel. ... + +Every line starts with a key word and can be followed by multiple +arguments. "config" starts a new config entry. The following lines +define attributes for this config option. Attributes can be the type of +the config option, input prompt, dependencies, help text and default +values. A config option can be defined multiple times with the same +name, but every definition can have only a single input prompt and the +type must not conflict. + +Menu attributes +--------------- + +A menu entry can have a number of attributes. Not all of them are +applicable everywhere (see syntax). + +- type definition: "bool"/"tristate"/"string"/"hex"/"int" + + Every config option must have a type. There are only two basic types: + tristate and string; the other types are based on these two. The type + definition optionally accepts an input prompt, so these two examples + are equivalent:: + + bool "Networking support" + + and:: + + bool + prompt "Networking support" + +- input prompt: "prompt" <prompt> ["if" <expr>] + + Every menu entry can have at most one prompt, which is used to display + to the user. Optionally dependencies only for this prompt can be added + with "if". + +- default value: "default" <expr> ["if" <expr>] + + A config option can have any number of default values. If multiple + default values are visible, only the first defined one is active. + Default values are not limited to the menu entry where they are + defined. This means the default can be defined somewhere else or be + overridden by an earlier definition. + The default value is only assigned to the config symbol if no other + value was set by the user (via the input prompt above). If an input + prompt is visible the default value is presented to the user and can + be overridden by him. + Optionally, dependencies only for this default value can be added with + "if". + + The default value deliberately defaults to 'n' in order to avoid bloating the + build. With few exceptions, new config options should not change this. The + intent is for "make oldconfig" to add as little as possible to the config from + release to release. + + Note: + Things that merit "default y/m" include: + + a) A new Kconfig option for something that used to always be built + should be "default y". + + b) A new gatekeeping Kconfig option that hides/shows other Kconfig + options (but does not generate any code of its own), should be + "default y" so people will see those other options. + + c) Sub-driver behavior or similar options for a driver that is + "default n". This allows you to provide sane defaults. + + d) Hardware or infrastructure that everybody expects, such as CONFIG_NET + or CONFIG_BLOCK. These are rare exceptions. + +- type definition + default value:: + + "def_bool"/"def_tristate" <expr> ["if" <expr>] + + This is a shorthand notation for a type definition plus a value. + Optionally dependencies for this default value can be added with "if". + +- dependencies: "depends on" <expr> + + This defines a dependency for this menu entry. If multiple + dependencies are defined, they are connected with '&&'. Dependencies + are applied to all other options within this menu entry (which also + accept an "if" expression), so these two examples are equivalent:: + + bool "foo" if BAR + default y if BAR + + and:: + + depends on BAR + bool "foo" + default y + +- reverse dependencies: "select" <symbol> ["if" <expr>] + + While normal dependencies reduce the upper limit of a symbol (see + below), reverse dependencies can be used to force a lower limit of + another symbol. The value of the current menu symbol is used as the + minimal value <symbol> can be set to. If <symbol> is selected multiple + times, the limit is set to the largest selection. + Reverse dependencies can only be used with boolean or tristate + symbols. + + Note: + select should be used with care. select will force + a symbol to a value without visiting the dependencies. + By abusing select you are able to select a symbol FOO even + if FOO depends on BAR that is not set. + In general use select only for non-visible symbols + (no prompts anywhere) and for symbols with no dependencies. + That will limit the usefulness but on the other hand avoid + the illegal configurations all over. + +- weak reverse dependencies: "imply" <symbol> ["if" <expr>] + + This is similar to "select" as it enforces a lower limit on another + symbol except that the "implied" symbol's value may still be set to n + from a direct dependency or with a visible prompt. + + Given the following example:: + + config FOO + tristate + imply BAZ + + config BAZ + tristate + depends on BAR + + The following values are possible: + + === === ============= ============== + FOO BAR BAZ's default choice for BAZ + === === ============= ============== + n y n N/m/y + m y m M/y/n + y y y Y/n + y n * N + === === ============= ============== + + This is useful e.g. with multiple drivers that want to indicate their + ability to hook into a secondary subsystem while allowing the user to + configure that subsystem out without also having to unset these drivers. + +- limiting menu display: "visible if" <expr> + + This attribute is only applicable to menu blocks, if the condition is + false, the menu block is not displayed to the user (the symbols + contained there can still be selected by other symbols, though). It is + similar to a conditional "prompt" attribute for individual menu + entries. Default value of "visible" is true. + +- numerical ranges: "range" <symbol> <symbol> ["if" <expr>] + + This allows to limit the range of possible input values for int + and hex symbols. The user can only input a value which is larger than + or equal to the first symbol and smaller than or equal to the second + symbol. + +- help text: "help" or "---help---" + + This defines a help text. The end of the help text is determined by + the indentation level, this means it ends at the first line which has + a smaller indentation than the first line of the help text. + "---help---" and "help" do not differ in behaviour, "---help---" is + used to help visually separate configuration logic from help within + the file as an aid to developers. + +- misc options: "option" <symbol>[=<value>] + + Various less common options can be defined via this option syntax, + which can modify the behaviour of the menu entry and its config + symbol. These options are currently possible: + + - "defconfig_list" + This declares a list of default entries which can be used when + looking for the default configuration (which is used when the main + .config doesn't exists yet.) + + - "modules" + This declares the symbol to be used as the MODULES symbol, which + enables the third modular state for all config symbols. + At most one symbol may have the "modules" option set. + + - "allnoconfig_y" + This declares the symbol as one that should have the value y when + using "allnoconfig". Used for symbols that hide other symbols. + +Menu dependencies +----------------- + +Dependencies define the visibility of a menu entry and can also reduce +the input range of tristate symbols. The tristate logic used in the +expressions uses one more state than normal boolean logic to express the +module state. Dependency expressions have the following syntax:: + + <expr> ::= <symbol> (1) + <symbol> '=' <symbol> (2) + <symbol> '!=' <symbol> (3) + <symbol1> '<' <symbol2> (4) + <symbol1> '>' <symbol2> (4) + <symbol1> '<=' <symbol2> (4) + <symbol1> '>=' <symbol2> (4) + '(' <expr> ')' (5) + '!' <expr> (6) + <expr> '&&' <expr> (7) + <expr> '||' <expr> (8) + +Expressions are listed in decreasing order of precedence. + +(1) Convert the symbol into an expression. Boolean and tristate symbols + are simply converted into the respective expression values. All + other symbol types result in 'n'. +(2) If the values of both symbols are equal, it returns 'y', + otherwise 'n'. +(3) If the values of both symbols are equal, it returns 'n', + otherwise 'y'. +(4) If value of <symbol1> is respectively lower, greater, lower-or-equal, + or greater-or-equal than value of <symbol2>, it returns 'y', + otherwise 'n'. +(5) Returns the value of the expression. Used to override precedence. +(6) Returns the result of (2-/expr/). +(7) Returns the result of min(/expr/, /expr/). +(8) Returns the result of max(/expr/, /expr/). + +An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 +respectively for calculations). A menu entry becomes visible when its +expression evaluates to 'm' or 'y'. + +There are two types of symbols: constant and non-constant symbols. +Non-constant symbols are the most common ones and are defined with the +'config' statement. Non-constant symbols consist entirely of alphanumeric +characters or underscores. +Constant symbols are only part of expressions. Constant symbols are +always surrounded by single or double quotes. Within the quote, any +other character is allowed and the quotes can be escaped using '\'. + +Menu structure +-------------- + +The position of a menu entry in the tree is determined in two ways. First +it can be specified explicitly:: + + menu "Network device support" + depends on NET + + config NETDEVICES + ... + + endmenu + +All entries within the "menu" ... "endmenu" block become a submenu of +"Network device support". All subentries inherit the dependencies from +the menu entry, e.g. this means the dependency "NET" is added to the +dependency list of the config option NETDEVICES. + +The other way to generate the menu structure is done by analyzing the +dependencies. If a menu entry somehow depends on the previous entry, it +can be made a submenu of it. First, the previous (parent) symbol must +be part of the dependency list and then one of these two conditions +must be true: + +- the child entry must become invisible, if the parent is set to 'n' +- the child entry must only be visible, if the parent is visible:: + + config MODULES + bool "Enable loadable module support" + + config MODVERSIONS + bool "Set version information on all module symbols" + depends on MODULES + + comment "module support disabled" + depends on !MODULES + +MODVERSIONS directly depends on MODULES, this means it's only visible if +MODULES is different from 'n'. The comment on the other hand is only +visible when MODULES is set to 'n'. + + +Kconfig syntax +-------------- + +The configuration file describes a series of menu entries, where every +line starts with a keyword (except help texts). The following keywords +end a menu entry: + +- config +- menuconfig +- choice/endchoice +- comment +- menu/endmenu +- if/endif +- source + +The first five also start the definition of a menu entry. + +config:: + + "config" <symbol> + <config options> + +This defines a config symbol <symbol> and accepts any of above +attributes as options. + +menuconfig:: + + "menuconfig" <symbol> + <config options> + +This is similar to the simple config entry above, but it also gives a +hint to front ends, that all suboptions should be displayed as a +separate list of options. To make sure all the suboptions will really +show up under the menuconfig entry and not outside of it, every item +from the <config options> list must depend on the menuconfig symbol. +In practice, this is achieved by using one of the next two constructs:: + + (1): + menuconfig M + if M + config C1 + config C2 + endif + + (2): + menuconfig M + config C1 + depends on M + config C2 + depends on M + +In the following examples (3) and (4), C1 and C2 still have the M +dependency, but will not appear under menuconfig M anymore, because +of C0, which doesn't depend on M:: + + (3): + menuconfig M + config C0 + if M + config C1 + config C2 + endif + + (4): + menuconfig M + config C0 + config C1 + depends on M + config C2 + depends on M + +choices:: + + "choice" [symbol] + <choice options> + <choice block> + "endchoice" + +This defines a choice group and accepts any of the above attributes as +options. A choice can only be of type bool or tristate. If no type is +specified for a choice, its type will be determined by the type of +the first choice element in the group or remain unknown if none of the +choice elements have a type specified, as well. + +While a boolean choice only allows a single config entry to be +selected, a tristate choice also allows any number of config entries +to be set to 'm'. This can be used if multiple drivers for a single +hardware exists and only a single driver can be compiled/loaded into +the kernel, but all drivers can be compiled as modules. + +A choice accepts another option "optional", which allows to set the +choice to 'n' and no entry needs to be selected. +If no [symbol] is associated with a choice, then you can not have multiple +definitions of that choice. If a [symbol] is associated to the choice, +then you may define the same choice (i.e. with the same entries) in another +place. + +comment:: + + "comment" <prompt> + <comment options> + +This defines a comment which is displayed to the user during the +configuration process and is also echoed to the output files. The only +possible options are dependencies. + +menu:: + + "menu" <prompt> + <menu options> + <menu block> + "endmenu" + +This defines a menu block, see "Menu structure" above for more +information. The only possible options are dependencies and "visible" +attributes. + +if:: + + "if" <expr> + <if block> + "endif" + +This defines an if block. The dependency expression <expr> is appended +to all enclosed menu entries. + +source:: + + "source" <prompt> + +This reads the specified configuration file. This file is always parsed. + +mainmenu:: + + "mainmenu" <prompt> + +This sets the config program's title bar if the config program chooses +to use it. It should be placed at the top of the configuration, before any +other statement. + +'#' Kconfig source file comment: + +An unquoted '#' character anywhere in a source file line indicates +the beginning of a source file comment. The remainder of that line +is a comment. + + +Kconfig hints +------------- +This is a collection of Kconfig tips, most of which aren't obvious at +first glance and most of which have become idioms in several Kconfig +files. + +Adding common features and make the usage configurable +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +It is a common idiom to implement a feature/functionality that are +relevant for some architectures but not all. +The recommended way to do so is to use a config variable named HAVE_* +that is defined in a common Kconfig file and selected by the relevant +architectures. +An example is the generic IOMAP functionality. + +We would in lib/Kconfig see:: + + # Generic IOMAP is used to ... + config HAVE_GENERIC_IOMAP + + config GENERIC_IOMAP + depends on HAVE_GENERIC_IOMAP && FOO + +And in lib/Makefile we would see:: + + obj-$(CONFIG_GENERIC_IOMAP) += iomap.o + +For each architecture using the generic IOMAP functionality we would see:: + + config X86 + select ... + select HAVE_GENERIC_IOMAP + select ... + +Note: we use the existing config option and avoid creating a new +config variable to select HAVE_GENERIC_IOMAP. + +Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is +introduced to overcome the limitation of select which will force a +config option to 'y' no matter the dependencies. +The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the +situation where select forces a symbol equals to 'y'. + +Adding features that need compiler support +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are several features that need compiler support. The recommended way +to describe the dependency on the compiler feature is to use "depends on" +followed by a test macro:: + + config STACKPROTECTOR + bool "Stack Protector buffer overflow detection" + depends on $(cc-option,-fstack-protector) + ... + +If you need to expose a compiler capability to makefiles and/or C source files, +`CC_HAS_` is the recommended prefix for the config option:: + + config CC_HAS_STACKPROTECTOR_NONE + def_bool $(cc-option,-fno-stack-protector) + +Build as module only +~~~~~~~~~~~~~~~~~~~~ +To restrict a component build to module-only, qualify its config symbol +with "depends on m". E.g.:: + + config FOO + depends on BAR && m + +limits FOO to module (=m) or disabled (=n). + +Kconfig recursive dependency limitations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you've hit the Kconfig error: "recursive dependency detected" you've run +into a recursive dependency issue with Kconfig, a recursive dependency can be +summarized as a circular dependency. The kconfig tools need to ensure that +Kconfig files comply with specified configuration requirements. In order to do +that kconfig must determine the values that are possible for all Kconfig +symbols, this is currently not possible if there is a circular relation +between two or more Kconfig symbols. For more details refer to the "Simple +Kconfig recursive issue" subsection below. Kconfig does not do recursive +dependency resolution; this has a few implications for Kconfig file writers. +We'll first explain why this issues exists and then provide an example +technical limitation which this brings upon Kconfig developers. Eager +developers wishing to try to address this limitation should read the next +subsections. + +Simple Kconfig recursive issue +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Read: Documentation/kbuild/Kconfig.recursion-issue-01 + +Test with:: + + make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig + +Cumulative Kconfig recursive issue +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Read: Documentation/kbuild/Kconfig.recursion-issue-02 + +Test with:: + + make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig + +Practical solutions to kconfig recursive issue +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Developers who run into the recursive Kconfig issue have two options +at their disposal. We document them below and also provide a list of +historical issues resolved through these different solutions. + + a) Remove any superfluous "select FOO" or "depends on FOO" + b) Match dependency semantics: + + b1) Swap all "select FOO" to "depends on FOO" or, + + b2) Swap all "depends on FOO" to "select FOO" + +The resolution to a) can be tested with the sample Kconfig file +Documentation/kbuild/Kconfig.recursion-issue-01 through the removal +of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already +since CORE_BELL_A depends on CORE. At times it may not be possible to remove +some dependency criteria, for such cases you can work with solution b). + +The two different resolutions for b) can be tested in the sample Kconfig file +Documentation/kbuild/Kconfig.recursion-issue-02. + +Below is a list of examples of prior fixes for these types of recursive issues; +all errors appear to involve one or more select's and one or more "depends on". + +============ =================================== +commit fix +============ =================================== +06b718c01208 select A -> depends on A +c22eacfe82f9 depends on A -> depends on B +6a91e854442c select A -> depends on A +118c565a8f2e select A -> select B +f004e5594705 select A -> depends on A +c7861f37b4c6 depends on A -> (null) +80c69915e5fb select A -> (null) (1) +c2218e26c0d0 select A -> depends on A (1) +d6ae99d04e1c select A -> depends on A +95ca19cf8cbf select A -> depends on A +8f057d7bca54 depends on A -> (null) +8f057d7bca54 depends on A -> select A +a0701f04846e select A -> depends on A +0c8b92f7f259 depends on A -> (null) +e4e9e0540928 select A -> depends on A (2) +7453ea886e87 depends on A > (null) (1) +7b1fff7e4fdf select A -> depends on A +86c747d2a4f0 select A -> depends on A +d9f9ab51e55e select A -> depends on A +0c51a4d8abd6 depends on A -> select A (3) +e98062ed6dc4 select A -> depends on A (3) +91e5d284a7f1 select A -> (null) +============ =================================== + +(1) Partial (or no) quote of error. +(2) That seems to be the gist of that fix. +(3) Same error. + +Future kconfig work +~~~~~~~~~~~~~~~~~~~ + +Work on kconfig is welcomed on both areas of clarifying semantics and on +evaluating the use of a full SAT solver for it. A full SAT solver can be +desirable to enable more complex dependency mappings and / or queries, +for instance on possible use case for a SAT solver could be that of handling +the current known recursive dependency issues. It is not known if this would +address such issues but such evaluation is desirable. If support for a full SAT +solver proves too complex or that it cannot address recursive dependency issues +Kconfig should have at least clear and well defined semantics which also +addresses and documents limitations or requirements such as the ones dealing +with recursive dependencies. + +Further work on both of these areas is welcomed on Kconfig. We elaborate +on both of these in the next two subsections. + +Semantics of Kconfig +~~~~~~~~~~~~~~~~~~~~ + +The use of Kconfig is broad, Linux is now only one of Kconfig's users: +one study has completed a broad analysis of Kconfig use in 12 projects [0]_. +Despite its widespread use, and although this document does a reasonable job +in documenting basic Kconfig syntax a more precise definition of Kconfig +semantics is welcomed. One project deduced Kconfig semantics through +the use of the xconfig configurator [1]_. Work should be done to confirm if +the deduced semantics matches our intended Kconfig design goals. + +Having well defined semantics can be useful for tools for practical +evaluation of depenencies, for instance one such use known case was work to +express in boolean abstraction of the inferred semantics of Kconfig to +translate Kconfig logic into boolean formulas and run a SAT solver on this to +find dead code / features (always inactive), 114 dead features were found in +Linux using this methodology [1]_ (Section 8: Threats to validity). + +Confirming this could prove useful as Kconfig stands as one of the the leading +industrial variability modeling languages [1]_ [2]_. Its study would help +evaluate practical uses of such languages, their use was only theoretical +and real world requirements were not well understood. As it stands though +only reverse engineering techniques have been used to deduce semantics from +variability modeling languages such as Kconfig [3]_. + +.. [0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf +.. [1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf +.. [2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf +.. [3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf + +Full SAT solver for Kconfig +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Although SAT solvers [4]_ haven't yet been used by Kconfig directly, as noted +in the previous subsection, work has been done however to express in boolean +abstraction the inferred semantics of Kconfig to translate Kconfig logic into +boolean formulas and run a SAT solver on it [5]_. Another known related project +is CADOS [6]_ (former VAMOS [7]_) and the tools, mainly undertaker [8]_, which +has been introduced first with [9]_. The basic concept of undertaker is to +exract variability models from Kconfig, and put them together with a +propositional formula extracted from CPP #ifdefs and build-rules into a SAT +solver in order to find dead code, dead files, and dead symbols. If using a SAT +solver is desirable on Kconfig one approach would be to evaluate repurposing +such efforts somehow on Kconfig. There is enough interest from mentors of +existing projects to not only help advise how to integrate this work upstream +but also help maintain it long term. Interested developers should visit: + +http://kernelnewbies.org/KernelProjects/kconfig-sat + +.. [4] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf +.. [5] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf +.. [6] https://cados.cs.fau.de +.. [7] https://vamos.cs.fau.de +.. [8] https://undertaker.cs.fau.de +.. [9] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
docs/misc/kconfig-language.txt deleted +0 -395
395 lines not on this page · raw message
docs/misc/kconfig-macro-language.rst new file +247 -0
247 lines not on this page · raw message
docs/misc/kconfig.rst renamed from docs/misc/kconfig.txt +126 -59
344 lines not on this page · raw message
xen/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +*.lex.c +*.tab.[ch]
xen/Kconfig +3 -15
@@ -2,24 +2,12 @@ # For a description of the syntax of this configuration file, # see docs/misc/kconfig-language.txt # -mainmenu "Xen/$SRCARCH $XEN_FULLVERSION Configuration" - -config SRCARCH - string - option env="SRCARCH" - -config ARCH - string - option env="ARCH" +mainmenu "Xen/$(SRCARCH) $(XEN_FULLVERSION) Configuration" config BROKEN bool -source "arch/$SRCARCH/Kconfig" - -config XEN_FULLVERSION - string - option env="XEN_FULLVERSION" +source "arch/$(SRCARCH)/Kconfig" config DEFCONFIG_LIST string
@@ -28,7 +16,7 @@ config DEFCONFIG_LIST config EXPERT string - option env="XEN_CONFIG_EXPERT" + default y if "$(XEN_CONFIG_EXPERT)" = "y" config LTO bool "Link Time Optimisation"
xen/Makefile +2 -2
@@ -267,7 +267,7 @@ $(foreach base,arch/x86/mm/guest_walk_% \ arch/x86/mm/shadow/guest_%, \ $(foreach ext,o i s,$(call build-intermediate,$(base).$(ext)))) -kconfig := silentoldconfig oldconfig config menuconfig defconfig \ +kconfig := oldconfig config menuconfig defconfig \ nconfig xconfig gconfig savedefconfig listnewconfig olddefconfig \ randconfig $(notdir $(wildcard arch/$(SRCARCH)/configs/*_defconfig)) .PHONY: $(kconfig)
@@ -275,7 +275,7 @@ $(kconfig): $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" $@ include/config/%.conf: include/config/auto.conf.cmd $(KCONFIG_CONFIG) - $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" silentoldconfig + $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" syncconfig # Allow people to just run `make` as before and not force them to configure $(KCONFIG_CONFIG):
xen/arch/arm/Kconfig +1 -1
@@ -1,6 +1,6 @@ config 64BIT bool - default ARCH != "arm32" + default "$(ARCH)" != "arm32" help Say yes to build a 64-bit Xen Say no to build a 32-bit Xen
xen/common/Kconfig +2 -10
@@ -72,14 +72,6 @@ config NEEDS_LIBELF config NEEDS_LIST_SORT bool -config HAS_BUILD_ID - string - option env="XEN_HAS_BUILD_ID" - -config HAS_CHECKPOLICY - string - option env="XEN_HAS_CHECKPOLICY" - menu "Speculative hardening" config SPECULATIVE_HARDEN_ARRAY
@@ -198,7 +190,7 @@ config XSM_FLASK_AVC_STATS config XSM_FLASK_POLICY bool "Compile Xen with a built-in FLASK security policy" - default y if HAS_CHECKPOLICY = "y" + default y if "$(XEN_HAS_CHECKPOLICY)" = "y" depends on XSM_FLASK ---help--- This includes a default XSM policy in the hypervisor so that the
@@ -350,7 +342,7 @@ config CRYPTO config LIVEPATCH bool "Live patching support" default X86 - depends on HAS_BUILD_ID = "y" + depends on "$(XEN_HAS_BUILD_ID)" = "y" ---help--- Allows a running Xen hypervisor to be dynamically patched using binary patches without rebooting. This is primarily used to binarily
xen/tools/kconfig/.gitignore +1 -5
@@ -1,12 +1,8 @@ # # Generated files # -config* -*.lex.c -*.tab.c -*.tab.h -zconf.hash.c *.moc +*conf-cfg # # configuration programs
xen/tools/kconfig/Makefile +97 -171
351 lines not on this page · raw message
xen/tools/kconfig/Makefile.host +87 -34
177 lines not on this page · raw message
xen/tools/kconfig/Makefile.kconfig +48 -4
88 lines not on this page · raw message
xen/tools/kconfig/conf.c +87 -104
375 lines not on this page · raw message
xen/tools/kconfig/confdata.c +305 -186
220 lines not on this page · raw message
xen/tools/kconfig/expr.c +152 -61
213 lines not on this page · raw message
xen/tools/kconfig/expr.h +101 -7
108 lines not on this page · raw message
xen/tools/kconfig/gconf-cfg.sh new file +30 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/lexer.l new file +471 -0
471 lines not on this page · raw message
xen/tools/kconfig/lxdialog/.gitignore deleted +0 -4
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/lxdialog/BIG.FAT.WARNING +1 -1
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/lxdialog/check-lxdialog.sh deleted +0 -91
91 lines not on this page · raw message
xen/tools/kconfig/lxdialog/checklist.c +1 -14
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/mconf-cfg.sh new file +47 -0
47 lines not on this page · raw message
xen/tools/kconfig/menu.c +229 -59
288 lines not on this page · raw message
xen/tools/kconfig/merge_config.sh +57 -30
87 lines not on this page · raw message
xen/tools/kconfig/nconf-cfg.sh new file +47 -0
47 lines not on this page · raw message
xen/tools/kconfig/nconf.c +20 -22
42 lines not on this page · raw message
xen/tools/kconfig/parser.y renamed from xen/tools/kconfig/zconf.y +199 -210
409 lines not on this page · raw message
xen/tools/kconfig/preprocess.c new file +574 -0
574 lines not on this page · raw message
xen/tools/kconfig/qconf-cfg.sh new file +32 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/qconf.cc +430 -320
750 lines not on this page · raw message
xen/tools/kconfig/qconf.h +73 -80
153 lines not on this page · raw message
xen/tools/kconfig/streamline_config.pl +44 -9
53 lines not on this page · raw message
xen/tools/kconfig/symbol.c +125 -170
295 lines not on this page · raw message
xen/tools/kconfig/tests/auto_submenu/Kconfig new file +52 -0
52 lines not on this page · raw message
xen/tools/kconfig/tests/auto_submenu/__init__.py new file +13 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/auto_submenu/expected_stdout new file +10 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice/Kconfig new file +56 -0
56 lines not on this page · raw message
xen/tools/kconfig/tests/choice/__init__.py new file +41 -0
41 lines not on this page · raw message
xen/tools/kconfig/tests/choice/alldef_expected_config new file +5 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice/allmod_expected_config new file +9 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice/allno_expected_config new file +5 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice/allyes_expected_config new file +9 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice/oldask0_expected_stdout new file +10 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice/oldask1_config new file +2 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice/oldask1_expected_stdout new file +15 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice_value_with_m_dep/Kconfig new file +21 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice_value_with_m_dep/__init__.py new file +16 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice_value_with_m_dep/config new file +2 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice_value_with_m_dep/expected_config new file +3 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/choice_value_with_m_dep/expected_stdout new file +4 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/conftest.py new file +291 -0
291 lines not on this page · raw message
xen/tools/kconfig/tests/err_recursive_dep/Kconfig new file +63 -0
63 lines not on this page · raw message
xen/tools/kconfig/tests/err_recursive_dep/__init__.py new file +10 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/err_recursive_dep/expected_stderr new file +38 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/err_recursive_inc/Kconfig new file +2 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/err_recursive_inc/Kconfig.inc1 new file +5 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/err_recursive_inc/Kconfig.inc2 new file +4 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/err_recursive_inc/Kconfig.inc3 new file +2 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/err_recursive_inc/__init__.py new file +11 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/err_recursive_inc/expected_stderr new file +6 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/inter_choice/Kconfig new file +25 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/inter_choice/__init__.py new file +15 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/inter_choice/defconfig new file +1 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/inter_choice/expected_config new file +4 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/new_choice_with_dep/Kconfig new file +39 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/new_choice_with_dep/__init__.py new file +15 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/new_choice_with_dep/config new file +3 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/new_choice_with_dep/expected_stdout new file +10 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/no_write_if_dep_unmet/Kconfig new file +16 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/no_write_if_dep_unmet/__init__.py new file +20 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/no_write_if_dep_unmet/config new file +1 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/no_write_if_dep_unmet/expected_config new file +5 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/builtin_func/Kconfig new file +27 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/builtin_func/__init__.py new file +9 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/builtin_func/expected_stderr new file +5 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/builtin_func/expected_stdout new file +1 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/circular_expansion/Kconfig new file +5 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/circular_expansion/__init__.py new file +11 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/circular_expansion/expected_stderr new file +1 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/escape/Kconfig new file +44 -0
44 lines not on this page · raw message
xen/tools/kconfig/tests/preprocess/escape/__init__.py new file +8 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/escape/expected_stderr new file +10 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/variable/Kconfig new file +53 -0
53 lines not on this page · raw message
xen/tools/kconfig/tests/preprocess/variable/__init__.py new file +8 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/preprocess/variable/expected_stderr new file +9 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/pytest.ini new file +7 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/rand_nested_choice/Kconfig new file +35 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/rand_nested_choice/__init__.py new file +17 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/rand_nested_choice/expected_stdout0 new file +2 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/rand_nested_choice/expected_stdout1 new file +4 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/tests/rand_nested_choice/expected_stdout2 new file +5 -0
Lines of this file are not shown. View the raw message.
xen/tools/kconfig/util.c +34 -52
86 lines not on this page · raw message
xen/tools/kconfig/zconf.gperf deleted +0 -49
49 lines not on this page · raw message
xen/tools/kconfig/zconf.hash.c_shipped deleted +0 -293
293 lines not on this page · raw message
xen/tools/kconfig/zconf.l deleted +0 -374
374 lines not on this page · raw message
xen/tools/kconfig/zconf.lex.c_shipped deleted +0 -2473
2,473 lines not on this page · raw message
xen/tools/kconfig/zconf.tab.c_shipped deleted +0 -2580
2,580 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Part of the diff is not shown here. View the raw message.
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
Quoted 29 lines · Anthony PERARD
This patch updates
Kconfigto a more recent version ofKconfig, found in Linux v5.4.0,219d54332a09("Linux 5.4").With the updated version of
Kconfig, other changes are necessary to avoid breaking the build.
Kconfigfiles:
- fixKconfigfiles that where using option env=*:
Since Linux commit104daea149c4("kconfig: reference environment variables directly and remove 'option env='"), we can access the environment directly via $() and "option env=" as been removed.
-CONFIG_EXPERT='y' will now appear in .config file if XEN_CONFIG_EXPERT=y in the environment. The alternative is to change "EXPERT" to "$(XEN_CONFIG_EXPERT)" in allKconfigfiles.
Makefile:
- silentoldconfig target as been removed fromKconfig. To updateinclude/generated/autoconf.h, we need to use syncconfig target instead.Makefile.kconfig:
- Import newer needed code from Linux's Makefile.lib and Kbuild.include and Makefile.build.
- Set Q to empty, Xen build system doesn't silence commands. Having Q empty mean we can import stuff from Linux without having to remove the leading $(Q) from build commands. And quiet='' means commands will be echoed.
- Add $(PHONY) to .PHONY. Like it is intended byKbuild.
Quoted 5 lines
Makefile.host is also updated and copied from Linux.
Dependency change:
- Now depends on flex/bison, maybe we could_shippedthose files like before. Linux doesn't do that anymore.
Content like that should not be checked in to being with, and I think it is entirely reasonable to require flex/bison in a build environment.
Indeed, README lists them as mandatory requirements.
Quoted 1 line
Signed-off-by Anthony PERARD <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
Quoted 9 lines · Andrew Cooper
Quoted 3 lines · Anthony PERARD
Dependency change:
- Now depends on flex/bison, maybe we could_shippedthose files like before. Linux doesn't do that anymore.Content like that should not be checked in to being with, and I think it is entirely reasonable to require flex/bison in a build environment.
Indeed, README lists them as mandatory requirements.
Hopefully, no one will notice that, even so they are mandatory on paper, you could build Xen (with the tools) without needed flex/bison. :-) But yes, I think flex/bison is like make, they are probably part of the minimum list of packages that needs to be installed when building anything on many distro.
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
In reply to Anthony PERARDJust two minor remarks:
Quoted 40 lines · Anthony PERARD
docs/misc/kconfig-macro-language.rst new file +37
-0@@ -0,0 +1,247 @@ +====================== +Kconfig macro language +====================== + +Concept +------- + +The basic idea was inspired by Make. When we look at Make, we notice sort of +two languages in one. One language describes dependency graphs consisting of +targets and prerequisites. The other is a macro language for performing textual +substitution. + +There is clear distinction between the two language stages. For example, you +can write a makefile like follows:: + + APP := foo + SRC := foo.c + CC := gcc + + $(APP): $(SRC) + $(CC) -o $(APP) $(SRC) + +The macro language replaces the variable references with their expanded form, +and handles as if the source file were input like follows:: + + foo: foo.c + gcc -o foo foo.c + +Then, Make analyzes the dependency graph and determines the targets to be +updated. + +The idea is quite similar in Kconfig - it is possible to describe a Kconfig +file like this:: + + CC := gcc + + config CC_HAS_FOO
docs/misc/kconfig-macro-language.rst line 47
Quoted 10 lines
docs/misc/kconfig-macro-language.rst new file +10
-0+ def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC)) + +The macro language in Kconfig processes the source file into the following +intermediate:: + + config CC_HAS_FOO + def_bool y + +Then, Kconfig moves onto the evaluation stage to resolve inter-symbol +dependency as explained in kconfig-language.txt.
.rst ?
xen/.gitignore line 2
Quoted 5 lines
xen/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +*.lex.c +*.tab.[ch]
Why do these get moved here from ...
xen/tools/kconfig/.gitignore line 5
Quoted 13 lines
xen/tools/kconfig/.gitignore +1
-5@@ -1,12 +1,8 @@ # # Generated files # -config* -*.lex.c -*.tab.c -*.tab.h -zconf.hash.c *.moc +*conf-cfg
here?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
Quoted 5 lines · Jan Beulich
Just two minor remarks:
Quoted 2 lines · Anthony PERARD
docs/misc/kconfig-macro-language.rst new file +0
-0
[...]
Quoted 4 lines
docs/misc/kconfig-macro-language.rst line 47
Quoted 2 lines
docs/misc/kconfig-macro-language.rst new file +2
-0+Then, Kconfig moves onto the evaluation stage to resolve inter-symbol +dependency as explained in kconfig-language.txt..rst ?
Looks like it, but that's an upstream bug. I'll try to send a patch upstream.
Quoted 8 lines
xen/.gitignore line 2
Quoted 5 lines
xen/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +*.lex.c +*.tab.[ch]Why do these get moved here from ...
Quoted 15 lines
xen/tools/kconfig/.gitignore line 5
Quoted 13 lines
xen/tools/kconfig/.gitignore +1
-5@@ -1,12 +1,8 @@ # # Generated files # -config* -*.lex.c -*.tab.c -*.tab.h -zconf.hash.c *.moc +*conf-cfghere?
Well, it's more like they move from linux.git/scripts/kconfig/.gitignore to linux.git/.gitignore
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
Quoted 26 lines · Anthony PERARD
Quoted 9 lines · Jan Beulich
xen/.gitignore line 2
Quoted 5 lines · Anthony PERARD
xen/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +*.lex.c +*.tab.[ch]Why do these get moved here from ...
Quoted 15 lines
xen/tools/kconfig/.gitignore line 5
Quoted 13 lines
xen/tools/kconfig/.gitignore +1
-5@@ -1,12 +1,8 @@ # # Generated files # -config* -*.lex.c -*.tab.c -*.tab.h -zconf.hash.c *.moc +*conf-cfghere?
Quoted 2 lines
Well, it's more like they move from linux.git/scripts/kconfig/.gitignore to linux.git/.gitignore
Which doesn't answer the why (for our repo).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Anthony PERARD
Quoted 22 lines · Jan Beulich
xen/.gitignore line 2
Quoted 5 lines · Anthony PERARD
xen/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +*.lex.c +*.tab.[ch]Why do these get moved here from ...
xen/tools/kconfig/.gitignore line 5
Quoted 13 lines
xen/tools/kconfig/.gitignore +1
-5@@ -1,12 +1,8 @@ # # Generated files # -config* -*.lex.c -*.tab.c -*.tab.h -zconf.hash.c *.moc +*conf-cfghere?
Quoted 3 lines
Quoted 2 lines
Well, it's more like they move from linux.git/scripts/kconfig/.gitignore to linux.git/.gitignore
Which doesn't answer the why (for our repo).
srsly?
We shouldn't edit headers we don't actually resync because it may make resyncing harder (allegedly), yet we shouldn't keep an in-sync directory in sync when we do actually resync it?
I find your lack of consistency in review requests impossible to predict.
As far as I'm concerned, Anthony's patch is fine.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
Quoted 27 lines · Andrew Cooper
Quoted 26 lines · Jan Beulich
Quoted 25 lines · Anthony PERARD
Quoted 8 lines · Jan Beulich
xen/.gitignore line 2
Quoted 5 lines · Anthony PERARD
xen/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +*.lex.c +*.tab.[ch]Why do these get moved here from ...
Quoted 14 lines
xen/tools/kconfig/.gitignore line 5
Quoted 13 lines
xen/tools/kconfig/.gitignore +1
-5@@ -1,12 +1,8 @@ # # Generated files # -config* -*.lex.c -*.tab.c -*.tab.h -zconf.hash.c *.moc +*conf-cfghere?
Well, it's more like they move from linux.git/scripts/kconfig/.gitignore to linux.git/.gitignore
Quoted 7 lines
Quoted 1 line
Which doesn't answer the why (for our repo).
srsly?
We shouldn't edit headers we don't actually resync because it may make resyncing harder (allegedly), yet we shouldn't keep an in-sync directory in sync when we do actually resync it?
What headers are you taking about? My question was about the placement of .gitignore entries only. I'm pretty sure I had previously expressed that I'm not overly happy to see needless scattering around of them. I'm merely trying to understand if here we have a case of "needless".
Quoted 1 line
I find your lack of consistency in review requests impossible to predict.
What consistency? What's wrong with putting the two lines in the top level .gitignore, or keeping them where they are? I anyway doubt there's a need to keep our .gitignore in sync with Linux'es.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
Quoted 10 lines · Jan Beulich
What headers are you taking about? My question was about the placement of .gitignore entries only. I'm pretty sure I had previously expressed that I'm not overly happy to see needless scattering around of them. I'm merely trying to understand if here we have a case of "needless".
Quoted 1 line
I find your lack of consistency in review requests impossible to predict.
What consistency? What's wrong with putting the two lines in the top level .gitignore, or keeping them where they are? I anyway doubt there's a need to keep our .gitignore in sync with Linux'es.
I think scattering the .gitignore around make them easier to manage, especially when entries aren't useful anymore. Otherwise, we end up with a .gitignore at the root with entries that aren't needed anymore because they can be hard to figure out if they are useful or not. Or, when globing is involve, we could end-up ignoring files that shouldn't.
I'm planning to import more of Kbuild, which Makefile.host comes from, to build only the hypervisor, so there's going to be other artefact that will be generated only in xen/. So I've added those two new entries in xen/.gitignore in anticipation, and to avoid getting xen/tools/kconfig out-of-sync with Linux's one (Well I didn't know those two entries were there in the first place).
I could add "/xen/**/*.tab.[ch]" in the root .gitignore if you prefer even though I don't like this approch.
Cheers,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
Quoted 12 lines · Anthony PERARD
Quoted 10 lines · Jan Beulich
What headers are you taking about? My question was about the placement of .gitignore entries only. I'm pretty sure I had previously expressed that I'm not overly happy to see needless scattering around of them. I'm merely trying to understand if here we have a case of "needless".
Quoted 1 line
I find your lack of consistency in review requests impossible to predict.
What consistency? What's wrong with putting the two lines in the top level .gitignore, or keeping them where they are? I anyway doubt there's a need to keep our .gitignore in sync with Linux'es.
Quoted 6 lines
I think scattering the .gitignore around make them easier to manage, especially when entries aren't useful anymore. Otherwise, we end up with a .gitignore at the root with entries that aren't needed anymore because they can be hard to figure out if they are useful or not. Or, when globing is involve, we could end-up ignoring files that shouldn't.
Right, especially this last point makes scattering entries have some value. But then let's truly scatter them, not accumulate all sorts of stuff in xen/.gitignore.
Quoted 9 lines
I'm planning to import more of
Kbuild, which Makefile.host comes from, to build only the hypervisor, so there's going to be other artefact that will be generated only in xen/. So I've added those two new entries in xen/.gitignore in anticipation, and to avoid getting xen/tools/kconfig out-of-sync with Linux's one (Well I didn't know those two entries were there in the first place).I could add "/xen/**/*.tab.[ch]" in the root .gitignore if you prefer even though I don't like this approch.
But this then still is too wide a pattern, as per above. A sufficiently specific one would be as good as one without path in a .gitignore deep enough into the tree, if we wanted to go the "truly scatter" route.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4
Quoted 31 lines · Jan Beulich
Quoted 12 lines · Anthony PERARD
Quoted 10 lines · Jan Beulich
What headers are you taking about? My question was about the placement of .gitignore entries only. I'm pretty sure I had previously expressed that I'm not overly happy to see needless scattering around of them. I'm merely trying to understand if here we have a case of "needless".
Quoted 1 line
I find your lack of consistency in review requests impossible to predict.
What consistency? What's wrong with putting the two lines in the top level .gitignore, or keeping them where they are? I anyway doubt there's a need to keep our .gitignore in sync with Linux'es.
Quoted 6 lines
I think scattering the .gitignore around make them easier to manage, especially when entries aren't useful anymore. Otherwise, we end up with a .gitignore at the root with entries that aren't needed anymore because they can be hard to figure out if they are useful or not. Or, when globing is involve, we could end-up ignoring files that shouldn't.
Right, especially this last point makes scattering entries have some value. But then let's truly scatter them, not accumulate all sorts of stuff in xen/.gitignore.
Quoted 7 lines
I'm planning to import more of
Kbuild, which Makefile.host comes from, to build only the hypervisor, so there's going to be other artefact that will be generated only in xen/. So I've added those two new entries in xen/.gitignore in anticipation, and to avoid getting xen/tools/kconfig out-of-sync with Linux's one (Well I didn't know those two entries were there in the first place).
Quoted 7 lines
Quoted 2 lines
I could add "/xen/**/*.tab.[ch]" in the root .gitignore if you prefer even though I don't like this approch.
But this then still is too wide a pattern, as per above. A sufficiently specific one would be as good as one without path in a .gitignore deep enough into the tree, if we wanted to go the "truly scatter" route.
Fine, we can have those two entries into kconfig/.gitignore, with a note in the commit message saying that the only thing different from upstream. That's where they belong for now.
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 4/8 xen: Have Kconfig check $(CC)'s version
In reply to Anthony PERARDThis import several files from Linux v5.3
- scripts/Kconfig.include
- scripts/clang-version.sh
- scripts/gcc-version.sh
and several config values from from Linux's init/Kconfig file.
Files are copied into scripts/ directory because that's were the files are found in Linux tree, and also because we are going to import more of Kbuild from Linux which is located in scripts/.
CONFIG_GCC_VERSION and CONFIG_CC_IS_CLANG are going to be use in follow-up patches.
--- xen/Kconfig | 17 ++++++++++++++++ xen/Makefile | 1 + xen/scripts/Kconfig.include | 39 ++++++++++++++++++++++++++++++++++++ xen/scripts/clang-version.sh | 19 ++++++++++++++++++ xen/scripts/gcc-version.sh | 20 ++++++++++++++++++ 5 files changed, 96 insertions(+) create mode 100644 xen/scripts/Kconfig.include create mode 100755 xen/scripts/clang-version.sh create mode 100755 xen/scripts/gcc-version.sh
xen/Kconfig +17 -0
@@ -4,9 +4,26 @@ # mainmenu "Xen/$(SRCARCH) $(XEN_FULLVERSION) Configuration" +source "scripts/Kconfig.include" + config BROKEN bool +config CC_IS_GCC + def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc) + +config GCC_VERSION + int + default $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC)) if CC_IS_GCC + default 0 + +config CC_IS_CLANG + def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) + +config CLANG_VERSION + int + default $(shell,$(BASEDIR)/scripts/clang-version.sh $(CC)) + source "arch/$(SRCARCH)/Kconfig" config DEFCONFIG_LIST
xen/Makefile +1 -0
@@ -267,6 +267,7 @@ $(foreach base,arch/x86/mm/guest_walk_% \ arch/x86/mm/shadow/guest_%, \ $(foreach ext,o i s,$(call build-intermediate,$(base).$(ext)))) +export CC LD kconfig := oldconfig config menuconfig defconfig \ nconfig xconfig gconfig savedefconfig listnewconfig olddefconfig \ randconfig $(notdir $(wildcard arch/$(SRCARCH)/configs/*_defconfig))
xen/scripts/Kconfig.include new file +39 -0
@@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Kconfig helper macros + +# Convenient variables +comma := , +quote := " +squote := ' +empty := +space := $(empty) $(empty) +dollar := $ +right_paren := ) +left_paren := ( + +# $(if-success,<command>,<then>,<else>) +# Return <then> if <command> exits with 0, <else> otherwise. +if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)") + +# $(success,<command>) +# Return y if <command> exits with 0, n otherwise +success = $(if-success,$(1),y,n) + +# $(failure,<command>) +# Return n if <command> exits with 0, y otherwise +failure = $(if-success,$(1),n,y) + +# $(cc-option,<flag>) +# Return y if the compiler supports <flag>, n otherwise +cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null) + +# $(ld-option,<flag>) +# Return y if the linker supports <flag>, n otherwise +ld-option = $(success,$(LD) -v $(1)) + +# check if $(CC) and $(LD) exist +$(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found) +$(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found) + +# gcc version including patch level +gcc-version := $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC))
xen/scripts/clang-version.sh new file +19 -0
@@ -0,0 +1,19 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# clang-version clang-command +# +# Print the compiler version of `clang-command' in a 5 or 6-digit form +# such as `50001' for clang-5.0.1 etc. + +compiler="$*" + +if ! ( $compiler --version | grep -q clang) ; then + echo 0 + exit 1 +fi + +MAJOR=$(echo __clang_major__ | $compiler -E -x c - | tail -n 1) +MINOR=$(echo __clang_minor__ | $compiler -E -x c - | tail -n 1) +PATCHLEVEL=$(echo __clang_patchlevel__ | $compiler -E -x c - | tail -n 1) +printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
xen/scripts/gcc-version.sh new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# gcc-version gcc-command +# +# Print the gcc version of `gcc-command' in a 5 or 6-digit form +# such as `29503' for gcc-2.95.3, `30301' for gcc-3.3.1, etc. + +compiler="$*" + +if [ ${#compiler} -eq 0 ]; then + echo "Error: No compiler specified." >&2 + printf "Usage:\n\t$0 <gcc-command>\n" >&2 + exit 1 +fi + +MAJOR=$(echo __GNUC__ | $compiler -E -x c - | tail -n 1) +MINOR=$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1) +PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1) +printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 4/8] xen: Have Kconfig check $(CC)'s version
xen/Makefile $(foreach base,arch/x86/mm/guest_walk_% \ · line 270
Quoted 9 lines · Anthony PERARD
xen/Makefile +1
-0@@ -267,6 +267,7 @@ $(foreach base,arch/x86/mm/guest_walk_% \ arch/x86/mm/shadow/guest_%, \ $(foreach ext,o i s,$(call build-intermediate,$(base).$(ext)))) +export CC LD
This probably wants to be higher up the file, where we export all the other variables. Perhaps also include CXX.
Otherwise, Acked-by: Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 4/8] xen: Have Kconfig check $(CC)'s version
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Anthony PERARD
xen/Makefile +0
-0@@ -267,6 +267,7 @@ $(foreach base,arch/x86/mm/guest_walk_% \ arch/x86/mm/shadow/guest_%, \ $(foreach ext,o i s,$(call build-intermediate,$(base).$(ext))))
Quoted 4 lines
xen/Makefile $(foreach base,arch/x86/mm/guest_walk_% \ · line 270
Quoted 1 line
xen/Makefile +1
-0+export CC LDThis probably wants to be higher up the file, where we export all the other variables. Perhaps also include CXX.
I'll move that to just after "export PYTHON". (Or maybe it should be after we include Config.mk? But it probably doesn't matter where it is.)
Quoted 1 line
Otherwise, Acked-by: Andrew Cooper <[email protected]>
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 5/8 xen: Import cc-ifversion from Kbuild
In reply to Anthony PERARDThis is in preparation of importing Kbuild to build Xen. We won't be able to include Config.mk so we will need a replacement for the macro `cc-ifversion'.
This patch imports parts of "scripts/Kbuild.include" from Linux v5.4, the macro cc-ifversion. It makes use of CONFIG_GCC_VERSION that Kconfig now provides.
Since they are no other use of Xen's `cc-ifversion' macro, we can remove it.
--- Config.mk | 5 ----- xen/Rules.mk | 1 + xen/common/coverage/Makefile | 8 ++++---- xen/scripts/Kbuild.include | 7 +++++++ 4 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 xen/scripts/Kbuild.include
Config.mk +0 -5
@@ -121,11 +121,6 @@ define cc-ver-check-closure endif endef -# cc-ifversion: Check compiler version and take branch accordingly -# Usage $(call cc-ifversion,lt,0x040700,string_if_y,string_if_n) -cc-ifversion = $(shell [ $(call cc-ver,$(CC),$(1),$(2)) = "y" ] \ - && echo $(3) || echo $(4)) - # Require GCC v4.1+ check-$(gcc) = $(call cc-ver-check,CC,0x040100,"Xen requires at least gcc-4.1") $(eval $(check-y))
xen/Rules.mk +1 -0
@@ -2,6 +2,7 @@ -include $(BASEDIR)/include/config/auto.conf include $(XEN_ROOT)/Config.mk +include $(BASEDIR)/scripts/Kbuild.include ifneq ($(origin crash_debug),undefined)
xen/common/coverage/Makefile +4 -4
@@ -1,10 +1,10 @@ obj-y += coverage.o ifneq ($(clang),y) obj-y += gcov_base.o gcov.o -obj-y += $(call cc-ifversion,lt,0x040700, \ - gcc_3_4.o, $(call cc-ifversion,lt,0x040900, \ - gcc_4_7.o, $(call cc-ifversion,lt,0x050000, \ - gcc_4_9.o, $(call cc-ifversion,lt,0x070000, \ +obj-y += $(call cc-ifversion,-lt,0407, \ + gcc_3_4.o, $(call cc-ifversion,-lt,0409, \ + gcc_4_7.o, $(call cc-ifversion,-lt,0500, \ + gcc_4_9.o, $(call cc-ifversion,-lt,0700, \ gcc_5.o, gcc_7.o)))) else obj-y += llvm.o
xen/scripts/Kbuild.include new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +#### +# kbuild: Generic definitions + +# cc-ifversion +# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) +cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 5/8] xen: Import cc-ifversion from Kbuild
Quoted 4 lines · Anthony PERARD
This is in preparation of importing
Kbuildto build Xen. We won't be able to include Config.mk so we will need a replacement for the macro `cc-ifversion'.
Quoted 8 lines
This patch imports parts of "
scripts/Kbuild.include" from Linux v5.4, the macro cc-ifversion. It makes use ofCONFIG_GCC_VERSIONthatKconfignow provides.Since they are no other use of Xen's `cc-ifversion' macro, we can remove it.
Signed-off-by Anthony PERARD <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 6/8 xen: Move CONFIG_INDIRECT_THUNK to Kconfig
In reply to Anthony PERARDNow that Kconfig has the capability to run shell command when generating CONFIG_* we can use it in some cases to test CFLAGS.
CONFIG_INDIRECT_THUNK is a good example that wants to exist both in Makefile and as a C macro, which Kconfig do. So use Kconfig to generate CONFIG_INDIRECT_THUNK and have the CFLAGS depends on that.
--- xen/arch/x86/Kconfig | 3 +++ xen/arch/x86/Rules.mk | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-)
xen/arch/x86/Kconfig +3 -0
@@ -32,6 +32,9 @@ config ARCH_DEFCONFIG string default "arch/x86/configs/x86_64_defconfig" +config INDIRECT_THUNK + def_bool $(cc-option,-mindirect-branch-register) + menu "Architecture Features" source "arch/Kconfig"
xen/arch/x86/Rules.mk +1 -3
@@ -71,11 +71,9 @@ CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE endif # Compile with thunk-extern, indirect-branch-register if avaiable. -ifneq ($(call cc-option,$(CC),-mindirect-branch-register,n),n) +ifeq ($(CONFIG_INDIRECT_THUNK),y) CFLAGS += -mindirect-branch=thunk-extern -mindirect-branch-register -CFLAGS += -DCONFIG_INDIRECT_THUNK CFLAGS += -fno-jump-tables -export CONFIG_INDIRECT_THUNK=y endif # If supported by the compiler, reduce stack alignment to 8 bytes. But allow
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 6/8] xen: Move CONFIG_INDIRECT_THUNK to Kconfig
Quoted 8 lines · Anthony PERARD
Now that
Kconfighas the capability to run shell command when generating CONFIG_* we can use it in some cases to test CFLAGS.
CONFIG_INDIRECT_THUNKis a good example that wants to exist both inMakefileand as a C macro, whichKconfigdo. So useKconfigto generateCONFIG_INDIRECT_THUNKand have the CFLAGS depends on that.Signed-off-by Anthony PERARD <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 6/8] xen: Move CONFIG_INDIRECT_THUNK to Kconfig
In reply to Anthony PERARDxen/arch/x86/Kconfig config ARCH_DEFCONFIG · line 36
Quoted 8 lines · Anthony PERARD
xen/arch/x86/Kconfig +2
-0@@ -32,6 +32,9 @@ config ARCH_DEFCONFIG string default "arch/x86/configs/x86_64_defconfig" +config INDIRECT_THUNK + def_bool $(cc-option,-mindirect-branch-register)
I'm not happy to see constructs like this appear. They leave a "# CONFIG_... is not defined" in .config for no reason when the expression evaluates to n. This may not matter much when considering just one such line, but it will when we gain dozens or hundreds. For options without prompts I think the default should only ever be set to y (or m, which we don't use). The above would then be written as
config INDIRECT_THUNK
def_bool y if $(cc-option,-mindirect-branch-register)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 6/8] xen: Move CONFIG_INDIRECT_THUNK to Kconfig
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/arch/x86/Kconfig +0
-0@@ -32,6 +32,9 @@ config ARCH_DEFCONFIG string default "arch/x86/configs/x86_64_defconfig"
Quoted 6 lines
xen/arch/x86/Kconfig config ARCH_DEFCONFIG · line 36
Quoted 2 lines
xen/arch/x86/Kconfig +2
-0+config INDIRECT_THUNK + def_bool $(cc-option,-mindirect-branch-register)I'm not happy to see constructs like this appear. They leave a "#
CONFIG_... is not defined" in .config for no reason when the expression evaluates to n.
For some reason, this doesn't happen. If $(CC) doesn't understand the option, the CONFIG_ doesn't appear at all in .config.
I guess "# CONFIG_... is not defined" comments are only useful for options that can be selected by users, so Kconfig would know not to ask the users again. So, for "options" that aren't for users, the comment doesn't need to exist.
Quoted 5 lines
This may not matter much when
considering just one such line, but it will when we gain dozens or hundreds. For options without prompts I think the default should only ever be set to y (or m, which we don't use). The above would then be written as
I think Kconfig developers have already done the work for that :-). So the construct def_bool y if $X isn't needed. Maybe I should read to doc about the difference between "def_bool n" and "def_bool y if n", but there is probably no difference.
Quoted 2 lines
config
INDIRECT_THUNKdef_bool y if $(cc-option,-mindirect-branch-register)
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 6/8] xen: Move CONFIG_INDIRECT_THUNK to Kconfig
Quoted 15 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/arch/x86/Kconfig +0
-0@@ -32,6 +32,9 @@ config ARCH_DEFCONFIG string default "arch/x86/configs/x86_64_defconfig"Quoted 6 lines
xen/arch/x86/Kconfig config ARCH_DEFCONFIG · line 36
Quoted 2 lines
xen/arch/x86/Kconfig +2
-0+config INDIRECT_THUNK + def_bool $(cc-option,-mindirect-branch-register)I'm not happy to see constructs like this appear. They leave a "#
CONFIG_... is not defined" in .config for no reason when the expression evaluates to n.
Quoted 2 lines
For some reason, this doesn't happen. If $(CC) doesn't understand the option, the
CONFIG_doesn't appear at all in .config.
Oh, then all is fine here. I guess they made this work more nicely in recent Kconfig - my comment above was based on observations in the past.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 6/8] xen: Move CONFIG_INDIRECT_THUNK to Kconfig
In reply to Anthony PERARDQuoted 23 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/arch/x86/Kconfig +0
-0@@ -32,6 +32,9 @@ config ARCH_DEFCONFIG string default "arch/x86/configs/x86_64_defconfig"Quoted 6 lines
xen/arch/x86/Kconfig config ARCH_DEFCONFIG · line 36
Quoted 2 lines
xen/arch/x86/Kconfig +2
-0+config INDIRECT_THUNK + def_bool $(cc-option,-mindirect-branch-register)I'm not happy to see constructs like this appear. They leave a "#
CONFIG_... is not defined" in .config for no reason when the expression evaluates to n.For some reason, this doesn't happen. If $(CC) doesn't understand the option, the
CONFIG_doesn't appear at all in .config.I guess "#
CONFIG_... is not defined" comments are only useful for options that can be selected by users, soKconfigwould know not to ask the users again. So, for "options" that aren't for users, the comment doesn't need to exist.
Quoted 8 lines
Quoted 5 lines
This may not matter much when
considering just one such line, but it will when we gain dozens or hundreds. For options without prompts I think the default should only ever be set to y (or m, which we don't use). The above would then be written asI think
Kconfigdevelopers have already done the work for that :-). So the constructdef_booly if $X isn't needed.
So I've checked - in Linux the longer construct is needed, while in Xen it isn't. I can't currently explain why this is, but I take it to mean that we're at risk of getting the stray extra lines emitted whenever something in our Kconfig files changes in a way triggering the same behavior as observed in Linux.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 6/8] xen: Move CONFIG_INDIRECT_THUNK to Kconfig
Quoted 30 lines · Jan Beulich
Quoted 29 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/arch/x86/Kconfig +0
-0@@ -32,6 +32,9 @@ config ARCH_DEFCONFIG string default "arch/x86/configs/x86_64_defconfig"Quoted 6 lines
xen/arch/x86/Kconfig config ARCH_DEFCONFIG · line 36
Quoted 2 lines
xen/arch/x86/Kconfig +2
-0+config INDIRECT_THUNK + def_bool $(cc-option,-mindirect-branch-register)I'm not happy to see constructs like this appear. They leave a "#
CONFIG_... is not defined" in .config for no reason when the expression evaluates to n.For some reason, this doesn't happen. If $(CC) doesn't understand the option, the
CONFIG_doesn't appear at all in .config.I guess "#
CONFIG_... is not defined" comments are only useful for options that can be selected by users, soKconfigwould know not to ask the users again. So, for "options" that aren't for users, the comment doesn't need to exist.Quoted 5 lines
This may not matter much when
considering just one such line, but it will when we gain dozens or hundreds. For options without prompts I think the default should only ever be set to y (or m, which we don't use). The above would then be written as
Quoted 8 lines
Quoted 2 lines
I think
Kconfigdevelopers have already done the work for that :-). So the constructdef_booly if $X isn't needed.So I've checked - in Linux the longer construct is needed, while in Xen it isn't. I can't currently explain why this is, but I take it to mean that we're at risk of getting the stray extra lines emitted whenever something in our
Kconfigfiles changes in a way triggering the same behavior as observed in Linux.
Which version of Linux?
Did you test with "def_bool" as the sole item in the config entry? And isn't a dependency of another config?
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 6/8] xen: Move CONFIG_INDIRECT_THUNK to Kconfig
Quoted 34 lines · Anthony PERARD
Quoted 33 lines · Jan Beulich
Quoted 31 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/arch/x86/Kconfig +0
-0@@ -32,6 +32,9 @@ config ARCH_DEFCONFIG string default "arch/x86/configs/x86_64_defconfig"Quoted 6 lines
xen/arch/x86/Kconfig config ARCH_DEFCONFIG · line 36
Quoted 2 lines
xen/arch/x86/Kconfig +2
-0+config INDIRECT_THUNK + def_bool $(cc-option,-mindirect-branch-register)I'm not happy to see constructs like this appear. They leave a "#
CONFIG_... is not defined" in .config for no reason when the expression evaluates to n.For some reason, this doesn't happen. If $(CC) doesn't understand the option, the
CONFIG_doesn't appear at all in .config.I guess "#
CONFIG_... is not defined" comments are only useful for options that can be selected by users, soKconfigwould know not to ask the users again. So, for "options" that aren't for users, the comment doesn't need to exist.Quoted 5 lines
This may not matter much when
considering just one such line, but it will when we gain dozens or hundreds. For options without prompts I think the default should only ever be set to y (or m, which we don't use). The above would then be written asI think
Kconfigdevelopers have already done the work for that :-). So the constructdef_booly if $X isn't needed.
Quoted 7 lines
Quoted 5 lines
So I've checked - in Linux the longer construct is needed, while in Xen it isn't. I can't currently explain why this is, but I take it to mean that we're at risk of getting the stray extra lines emitted whenever something in our
Kconfigfiles changes in a way triggering the same behavior as observed in Linux.Which version of Linux?
5.5
Quoted 1 line
Did you test with "
def_bool" as the sole item in the config entry?
This
config CC_IS_CLANG
def_bool $(success,$(CC) --version | head -n 1 | grep -q clang)
produces
# CONFIG_CC_IS_CLANG is not set
in all configs I'm building. (And it's by far not the only one. In fact I've been carrying a patch which changes various such lines, and as a result of your earlier reply I was intending to drop it. Just that it didn't work as expected.)
Quoted 1 line
And isn't a dependency of another config?
This isn't supposed to matter for the presence/absence of said line in the resulting .config. I'm not going to exclude though that the current lack of any dependency in Xen is the reason for the difference in behavior.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 7/8 xen: Use $(CONFIG_CC_IS_CLANG) instead of $(clang) in Makefile
In reply to Anthony PERARDKconfig can check if $(CC) is clang or not, if it is CONFIG_CC_IS_CLANG will be set.
With that patch, the hypervisor can be built using clang by running make CC=clang CXX=clang++ without needed to provide an extra clang parameter.
make clang=y still works as Config.mk will set CC and CXX.
--- xen/Rules.mk | 8 ++++---- xen/arch/x86/Rules.mk | 2 +- xen/common/coverage/Makefile | 2 +- xen/include/Makefile | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
xen/Rules.mk +4 -4
@@ -64,7 +64,7 @@ CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h CFLAGS-$(CONFIG_DEBUG_INFO) += -g CFLAGS += '-D__OBJECT_FILE__="$@"' -ifneq ($(clang),y) +ifneq ($(CONFIG_CC_IS_CLANG),y) # Clang doesn't understand this command line argument, and doesn't appear to # have an suitable alternative. The resulting compiled binary does function, # but has an excessively large symbol table.
@@ -126,7 +126,7 @@ subdir-all := $(subdir-y) $(subdir-n) $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY ifeq ($(CONFIG_COVERAGE),y) -ifeq ($(clang),y) +ifeq ($(CONFIG_CC_IS_CLANG),y) COV_FLAGS := -fprofile-instr-generate -fcoverage-mapping else COV_FLAGS := -fprofile-arcs -ftest-coverage
@@ -143,7 +143,7 @@ endif ifeq ($(CONFIG_LTO),y) CFLAGS += -flto -LDFLAGS-$(clang) += -plugin LLVMgold.so +LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so # Would like to handle all object files as bitcode, but objects made from # pure asm are in a different format and have to be collected separately. # Mirror the directory tree, collecting them as built_in_bin.o.
@@ -197,7 +197,7 @@ SRCPATH := $(patsubst $(BASEDIR)/%,%,$(CURDIR)) %.o: %.c Makefile ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y) $(CC) $(CFLAGS) -c $< -o $(@D)/.$(@F).tmp -ifeq ($(clang),y) +ifeq ($(CONFIG_CC_IS_CLANG),y) $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(@D)/.$(@F).tmp $@ else $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(@D)/.$(@F).tmp $@
xen/arch/x86/Rules.mk +1 -1
@@ -12,7 +12,7 @@ CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CU # Prevent floating-point variables from creeping into Xen. CFLAGS += -msoft-float -ifeq ($(clang),y) +ifeq ($(CONFIG_CC_IS_CLANG),y) # Note: Any test which adds -no-integrated-as will cause subsequent tests to # succeed, and not trigger further additions. #
xen/common/coverage/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-y += coverage.o -ifneq ($(clang),y) +ifneq ($(CONFIG_CC_IS_CLANG),y) obj-y += gcov_base.o gcov.o obj-y += $(call cc-ifversion,-lt,0407, \ gcc_3_4.o, $(call cc-ifversion,-lt,0409, \
xen/include/Makefile +1 -1
@@ -36,7 +36,7 @@ cppflags-y := -include public/xen-compat.h -DXEN_GENERATING_COMPA cppflags-$(CONFIG_X86) += -m32 # 8-byte types are 4-byte aligned on x86_32 ... -ifeq ($(clang),y) +ifeq ($(CONFIG_CC_IS_CLANG),y) prefix-$(CONFIG_X86) := \#pragma pack(push, 4) suffix-$(CONFIG_X86) := \#pragma pack(pop) else
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 7/8] xen: Use $(CONFIG_CC_IS_CLANG) instead of $(clang) in Makefile
Quoted 10 lines · Anthony PERARD
Kconfigcan check if $(CC) is clang or not, if it isCONFIG_CC_IS_CLANGwill be set.With that patch, the hypervisor can be built using clang by running
make CC=clang CXX=clang++without needed to provide an extra clang parameter.
make clang=ystill works as Config.mk will set CC and CXX.Signed-off-by Anthony PERARD <[email protected]>
This is a massive improvement on the status quo.
Do we perhaps want to tweak the relevant CI scripts and other build instructions now that clang=y is obsolete?
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 7/8] xen: Use $(CONFIG_CC_IS_CLANG) instead of $(clang) in Makefile
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Anthony PERARD
Kconfigcan check if $(CC) is clang or not, if it isCONFIG_CC_IS_CLANGwill be set.With that patch, the hypervisor can be built using clang by running
make CC=clang CXX=clang++without needed to provide an extra clang parameter.
make clang=ystill works as Config.mk will set CC and CXX.
Quoted 8 lines
Quoted 1 line
Signed-off-by Anthony PERARD <[email protected]>Acked-by Andrew Cooper <[email protected]>This is a massive improvement on the status quo.
Do we perhaps want to tweak the relevant CI scripts and other build instructions now that clang=y is obsolete?
No, clang=y isn't obsolete yet. We need to change the tools side as well, there's a few $(clang) in there. So we need one more patch to remove them.
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 8/8 xen: Move GCC_HAS_VISIBILITY_ATTRIBUTE to Kconfig and common
In reply to Anthony PERARDThe check for $(CC) -fvisibility=hidden is done by both arm and x86, so the patch also move the check to the common area.
The check doesn't check if $(CC) is gcc, and clang can accept that option as well, so s/GCC/CC/ is done to the define name.
--- xen/Kconfig | 4 ++++ xen/arch/arm/Rules.mk | 4 ---- xen/arch/x86/Rules.mk | 5 ----- xen/include/xen/compiler.h | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-)
xen/Kconfig +4 -0
@@ -24,6 +24,10 @@ config CLANG_VERSION int default $(shell,$(BASEDIR)/scripts/clang-version.sh $(CC)) +# -fvisibility=hidden reduces -fpic cost, if it's available +config CC_HAS_VISIBILITY_ATTRIBUTE + def_bool $(cc-option,-fvisibility=hidden) + source "arch/$(SRCARCH)/Kconfig" config DEFCONFIG_LIST
xen/arch/arm/Rules.mk +0 -4
@@ -18,10 +18,6 @@ CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-a15 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc -ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n) -CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE -endif - EARLY_PRINTK := n ifeq ($(CONFIG_DEBUG),y)
xen/arch/x86/Rules.mk +0 -5
@@ -65,11 +65,6 @@ CFLAGS += -mno-red-zone -fpic -fno-asynchronous-unwind-tables # SSE setup for variadic function calls. CFLAGS += -mno-sse $(call cc-option,$(CC),-mskip-rax-setup) -# -fvisibility=hidden reduces -fpic cost, if it's available -ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n) -CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE -endif - # Compile with thunk-extern, indirect-branch-register if avaiable. ifeq ($(CONFIG_INDIRECT_THUNK),y) CFLAGS += -mindirect-branch=thunk-extern -mindirect-branch-register
xen/include/xen/compiler.h +1 -1
@@ -78,7 +78,7 @@#define __must_be_array (a) \ BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) -#ifdef GCC_HAS_VISIBILITY_ATTRIBUTE +#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE /* Results in more efficient PIC code (no indirections through GOT or PLT). */ #pragma GCC visibility push(hidden)#endif
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 8/8] xen: Move GCC_HAS_VISIBILITY_ATTRIBUTE to Kconfig and common
xen/include/xen/compiler.h line 83
Quoted 12 lines · Anthony PERARD
xen/include/xen/compiler.h +1
-1@@ -78,7 +78,7 @@#define __must_be_array (a) \ BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) -#ifdef GCC_HAS_VISIBILITY_ATTRIBUTE +#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE /* Results in more efficient PIC code (no indirections through GOT or PLT). */ #pragma GCC visibility push(hidden)
(I realise we are getting into archaeology, but) Why do we have this as a pragma gcc?
Surely it would be simpler to just feed -fvisibility=hidden into CFLAGS?
Ack for the overall change, but I expect we can clean this up a bit more as well.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH 8/8] xen: Move GCC_HAS_VISIBILITY_ATTRIBUTE to Kconfig and common
Quoted 17 lines · Andrew Cooper
xen/include/xen/compiler.h line 83
Quoted 12 lines · Anthony PERARD
xen/include/xen/compiler.h +1
-1@@ -78,7 +78,7 @@#define __must_be_array (a) \ BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) -#ifdef GCC_HAS_VISIBILITY_ATTRIBUTE +#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE /* Results in more efficient PIC code (no indirections through GOT or PLT). */ #pragma GCC visibility push(hidden)(I realise we are getting into archaeology, but) Why do we have this as a pragma gcc?
Quoted 1 line
Surely it would be simpler to just feed -fvisibility=hidden into CFLAGS?
No, as per the (admittedly not very explicit) commit message of the change introducing it. Quoting gcc documentation for making it more obvious:
"extern declarations are not affected by ‘-fvisibility’, so a lot of code
can be recompiled with ‘-fvisibility=hidden’ with no modifications. However, this means that calls to extern functions with no explicit visibility use the PLT, so it is more effective to use __attribute ((visibility)) and/or #pragma GCC visibility to tell the compiler which extern declarations should be treated as hidden."
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel