diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index c858f8419ebafeeb7d700be52c919d6ee0770201..c420676c6fe31d3ac66c1b63f165888ccd0efd6e 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt @@ -147,6 +147,7 @@ applicable everywhere (see syntax). - "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. - "env"=<value> This imports the environment variable into Kconfig. It behaves like diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 3a9c674932607ca9c1bdc4d62a15a98829e9b213..c1d53200c306dc6202cbcc13555a05333c34411a 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -199,6 +199,12 @@ void menu_add_option(int token, char *arg) { switch (token) { case T_OPT_MODULES: + if (modules_sym) + zconf_error("symbol '%s' redefines option 'modules'" + " already defined by symbol '%s'", + current_entry->sym->name, + modules_sym->name + ); modules_sym = current_entry->sym; break; case T_OPT_DEFCONFIG_LIST: