xen: Kconfig update with few extra
v3 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-v3
v3:
- change in patch 2. gcc-version.sh now behave like clang-version.sh. otherwise, the series should be ready.
v2:
- nit changes in patch 1 and 2.
Cheers,
Anthony PERARD (6):
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 | 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/Kconfig | 34 +-
xen/Makefile | 6 +-
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 | 25 +
xen/tools/kconfig/.gitignore | 3 +-
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 -----------------
125 files changed, 5764 insertions(+), 8093 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/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 v3 1/6 xen: Update Kconfig to Linux v5.4
This 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.
The .gitignore in kconfig/ has more entries, compared to upstream, for file generated by Makefile.host.
---
Notes:
v2:
- Moved *.lex.c *.tab.[ch] back to kconfig/, and updated patch description describing why it's different from upstream.
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/Kconfig | 18 +-
xen/Makefile | 4 +-
xen/arch/arm/Kconfig | 2 +-
xen/common/Kconfig | 12 +-
xen/tools/kconfig/.gitignore | 3 +-
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 -----------------
113 files changed, 5637 insertions(+), 8066 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 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/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
@@ -69,14 +69,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
@@ -195,7 +187,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
@@ -347,7 +339,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 -2
@@ -1,12 +1,11 @@ # # 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
222 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.
PATCH v3 2/6 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.
But gcc-version.sh have been modified to return "0" when $CC isn't GCC, like clang-version.sh do.
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.
---
Notes:
v3:
- Have gcc-version behave like clang-version and return 0 when the compiler tested isn't the expected one.
v2:
- move the export CC* earlier in xen/Makefile, and add CXX to the list.
xen/Kconfig | 16 +++++++++++++++ xen/Makefile | 2 ++ xen/scripts/Kconfig.include | 39 ++++++++++++++++++++++++++++++++++++ xen/scripts/clang-version.sh | 19 ++++++++++++++++++ xen/scripts/gcc-version.sh | 25 +++++++++++++++++++++++ 5 files changed, 101 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 +16 -0
@@ -4,9 +4,25 @@ # 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)) + +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 +2 -0
@@ -18,6 +18,8 @@ export XEN_CONFIG_EXPERT ?= n PYTHON_INTERPRETER := $(word 1,$(shell which python3 python python2 2>/dev/null) python) export PYTHON ?= $(PYTHON_INTERPRETER) +export CC CXX LD + export BASEDIR := $(CURDIR) export XEN_ROOT := $(BASEDIR)/..
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 +25 -0
@@ -0,0 +1,25 @@ +#!/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 + +if ! ( $compiler --version | head -n 1 | grep -q gcc ); then + echo 0 + 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 v3 2/6] xen: Have Kconfig check $(CC)'s version
Quoted 14 lines · Anthony PERARD
xen/Kconfig +5
-0@@ -4,9 +4,25 @@ # 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) +
xen/Kconfig line 24
Quoted 10 lines
xen/Kconfig +10
-0+config GCC_VERSION + int + default $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC)) + +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))
I continue to be unhappy about the redundancy, but I will accept it if others indeed think this is helpful. However, I don't see then why the setting of CC_IS_* need another shell invocation each - this could just be *_VERSION > 0 then, seeing that the scripts already to a respective grep of the --version output.
Even better would imo be, as suggested before, a "depends on CC_IS_*" on each *_VERSION.
As a nit - common style elsewhere would suggest that there ought to be a blank after the commas in $(macro, ...) invocations. This would then extend to Kconfig.include as well, unless that's a largely verbatim inherited file.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH v3 2/6] xen: Have Kconfig check $(CC)'s version
Quoted 23 lines · Jan Beulich
Quoted 22 lines · Anthony PERARD
xen/Kconfig +13
-0@@ -4,9 +4,25 @@ # 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)) + +config CC_IS_CLANG + def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) + +config CLANG_VERSION
Quoted 8 lines
xen/Kconfig line 24
Quoted 2 lines
xen/Kconfig +2
-0+ int + default $(shell,$(BASEDIR)/scripts/clang-version.sh $(CC))I continue to be unhappy about the redundancy, but I will accept it if others indeed think this is helpful. However, I don't see then why the setting of CC_IS_* need another shell invocation each - this could just be
*_VERSION> 0 then, seeing that the scripts already to a respective grep of the --version output.
From functionality point of view, replacing the macro by "def_bool %_VERSION > 0" in "config CC_IS_%" would be fine, even so it would be weird to read. I think that would need a comment saying:
# %-version.sh is expected to return "0" when $(CC) isn't %
That could be done on commit.
Quoted 2 lines
Even better would imo be, as suggested before, a "depends on CC_IS_*" on each
*_VERSION.
Haven't we discussed this before?
Quoted 4 lines
As a nit - common style elsewhere would suggest that there ought to be a blank after the commas in $(macro, ...) invocations. This would then extend to
Kconfig.includeas well, unless that's a largely verbatim inherited file.
That's not a good idea, it may not matter in this case but adding a space after commas in some other cases will not do what one wants. make and Kconfig keeps the spaces when expanding the macro.
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH v3 2/6] xen: Have Kconfig check $(CC)'s version
Quoted 33 lines · Anthony PERARD
Quoted 23 lines · Jan Beulich
Quoted 22 lines · Anthony PERARD
xen/Kconfig +13
-0@@ -4,9 +4,25 @@ # 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)) + +config CC_IS_CLANG + def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) + +config CLANG_VERSIONQuoted 8 lines
xen/Kconfig line 24
Quoted 2 lines
xen/Kconfig +2
-0+ int + default $(shell,$(BASEDIR)/scripts/clang-version.sh $(CC))I continue to be unhappy about the redundancy, but I will accept it if others indeed think this is helpful. However, I don't see then why the setting of CC_IS_* need another shell invocation each - this could just be
*_VERSION> 0 then, seeing that the scripts already to a respective grep of the --version output.
Quoted 6 lines
From functionality point of view, replacing the macro by "
def_bool%_VERSION > 0" in "config CC_IS_%" would be fine, even so it would be weird to read. I think that would need a comment saying:
# %-version.sh is expected to return "0" when $(CC) isn't %That could be done on commit.
Sure.
Quoted 4 lines
Quoted 2 lines
Even better would imo be, as suggested before, a "depends on CC_IS_*" on each
*_VERSION.Haven't we discussed this before?
Indeed, hence also my "as suggested before". I remain unconvinced that is it useful to have e.g.
CONFIG_GCC_VERSION=80300CONFIG_CLANG_VERSION=0
in xen/.config. This is at best confusing, because it may not represent what the system actually has installed (which I realize is also not the intention, but the variable naming suggests that this is what was found on the system; I have no better naming suggestion, to preempt a possible question to this effect).
Quoted 8 lines
Quoted 4 lines
As a nit - common style elsewhere would suggest that there ought to be a blank after the commas in $(macro, ...) invocations. This would then extend to
Kconfig.includeas well, unless that's a largely verbatim inherited file.That's not a good idea, it may not matter in this case but adding a space after commas in some other cases will not do what one wants. make and
Kconfigkeeps the spaces when expanding the macro.
Where blanks matter they should of course be omitted. When they don't matter, personally I think common style guidelines should be honored. But this may be just me ...
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH v3 2/6] xen: Have Kconfig check $(CC)'s version
Quoted 4 lines · Jan Beulich
On 16.01.2020 13:29, Anthony PERARD wrote:
Indeed, hence also my "as suggested before". I remain unconvinced that is it useful to have e.g.
Quoted 8 lines
CONFIG_GCC_VERSION=80300CONFIG_CLANG_VERSION=0in xen/.config. This is at best confusing, because it may not represent what the system actually has installed (which I realize is also not the intention, but the variable naming suggests that this is what was found on the system; I have no better naming suggestion, to preempt a possible question to this effect).
After a talk on #xendevel yesterday, I have George agreeing that we should keep the same behavior as the one Linux have. And Ian saying that we should copy entire files where we can. If we modify the behavior of %_VERSION, it would make it more difficult to copy entire files from %Linux later.
So, now, can we finally commit the patch series, with both %_VERSION set, and let this bikeshedding rest, and move on?
Thank you,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH v3 2/6] xen: Have Kconfig check $(CC)'s version
Quoted 14 lines · Anthony PERARD
Quoted 4 lines · Jan Beulich
On 16.01.2020 13:29, Anthony PERARD wrote:
Indeed, hence also my "as suggested before". I remain unconvinced that is it useful to have e.g.Quoted 8 lines
CONFIG_GCC_VERSION=80300CONFIG_CLANG_VERSION=0in xen/.config. This is at best confusing, because it may not represent what the system actually has installed (which I realize is also not the intention, but the variable naming suggests that this is what was found on the system; I have no better naming suggestion, to preempt a possible question to this effect).
Quoted 8 lines
After a talk on #xendevel yesterday, I have George agreeing that we should keep the same behavior as the one Linux have. And Ian saying that we should copy entire files where we can. If we modify the behavior of %_VERSION, it would make it more difficult to copy entire files from %Linux later.
So, now, can we finally commit the patch series, with both %_VERSION set, and let this bikeshedding rest, and move on?
Well, someone feel free to go ahead then. Every time I'll get to see this I'll be tempted to clean up the redundancy, but so be it. (I don't view this as bike shedding at all, btw. While every individual instance may not matter much, it is the sum of them that I'm worried about.)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 3/6 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
PATCH v3 4/6 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
@@ -31,6 +31,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
PATCH v3 5/6 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
PATCH v3 6/6 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
@@ -23,6 +23,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