Skip to content

Commit 8373b7d

Browse files
committed
Documentation: kconfig: add recommended way to describe compiler support
It would be nice if the source code is written in the same style. This proposes the convention for describing the compiler capability in Kconfig. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent caa91ba commit 8373b7d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Documentation/kbuild/kconfig-language.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,24 @@ config option to 'y' no matter the dependencies.
473473
The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
474474
situation where select forces a symbol equals to 'y'.
475475

476+
Adding features that need compiler support
477+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
478+
479+
There are several features that need compiler support. The recommended way
480+
to describe the dependency on the compiler feature is to use "depends on"
481+
followed by a test macro.
482+
483+
config CC_STACKPROTECTOR
484+
bool "Stack Protector buffer overflow detection"
485+
depends on $(cc-option,-fstack-protector)
486+
...
487+
488+
If you need to expose a compiler capability to makefiles and/or C source files,
489+
CC_HAS_ is the recommended prefix for the config option.
490+
491+
config CC_HAS_STACKPROTECTOR_NONE
492+
def_bool $(cc-option,-fno-stack-protector)
493+
476494
Build as module only
477495
~~~~~~~~~~~~~~~~~~~~
478496
To restrict a component build to module-only, qualify its config symbol

0 commit comments

Comments
 (0)