[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210709222523.17639-2-nick.alcock@oracle.com>
Date: Fri, 9 Jul 2021 23:25:17 +0100
From: Nick Alcock <nick.alcock@...cle.com>
To: jeyu@...nel.org, masahiroy@...nel.org
Cc: linux-modules@...r.kernel.org, linux-kernel@...r.kernel.org,
arnd@...db.de
Subject: [PATCH 1/7] kbuild: bring back tristate.conf
tristate.conf was dropped because it is not needed to build a
modules.builtin (although dropping it introduces a few false positives
into modules.builtin support), and doing so avoids one round of
recursion through the build tree to build it. But kallmodsyms support
requires building a mapping from object file name to built-in module
name for all builtin modules: this seems to me impossible to accomplish
without parsing all makefiles under the influence of tristate.conf,
since the makefiles are the only place this mapping is recorded.
So bring it back for this purpose.
This partially reverts commit 8b41fc4454e36fbfdbb23f940d023d4dece2de29.
Signed-off-by: Nick Alcock <nick.alcock@...cle.com>
---
scripts/kconfig/confdata.c | 41 ++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index cf72680cd769..8f4f1b373dd6 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -725,6 +725,25 @@ static struct conf_printer header_printer_cb =
.print_comment = header_print_comment,
};
+/*
+ * Tristate printer
+ *
+ * This printer is used when generating the `include/config/tristate.conf' file.
+ */
+static void
+tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
+{
+
+ if (sym->type == S_TRISTATE && *value != 'n')
+ fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value));
+}
+
+static struct conf_printer tristate_printer_cb =
+{
+ .print_symbol = tristate_print_symbol,
+ .print_comment = kconfig_print_comment,
+};
+
static void conf_write_symbol(FILE *fp, struct symbol *sym,
struct conf_printer *printer, void *printer_arg)
{
@@ -1058,7 +1077,7 @@ int conf_write_autoconf(int overwrite)
struct symbol *sym;
const char *name;
const char *autoconf_name = conf_get_autoconfig_name();
- FILE *out, *out_h;
+ FILE *out, *tristate, *out_h;
int i;
if (!overwrite && is_present(autoconf_name))
@@ -1073,6 +1092,13 @@ int conf_write_autoconf(int overwrite)
if (!out)
return 1;
+ tristate = fopen(".tmpconfig_tristate", "w");
+ if (!tristate) {
+ fclose(out);
+ fclose(tristate);
+ return 1;
+ }
+
out_h = fopen(".tmpconfig.h", "w");
if (!out_h) {
fclose(out);
@@ -1080,6 +1106,7 @@ int conf_write_autoconf(int overwrite)
}
conf_write_heading(out, &kconfig_printer_cb, NULL);
+ conf_write_heading(tristate, &tristate_printer_cb, NULL);
conf_write_heading(out_h, &header_printer_cb, NULL);
for_all_symbols(i, sym) {
@@ -1087,11 +1114,13 @@ int conf_write_autoconf(int overwrite)
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
continue;
- /* write symbols to auto.conf and autoconf.h */
+ /* write symbols to auto.conf, tristate and autoconf.h */
conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
+ conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);
conf_write_symbol(out_h, sym, &header_printer_cb, NULL);
}
fclose(out);
+ fclose(tristate);
fclose(out_h);
name = getenv("KCONFIG_AUTOHEADER");
@@ -1102,6 +1131,14 @@ int conf_write_autoconf(int overwrite)
if (rename(".tmpconfig.h", name))
return 1;
+ name = getenv("KCONFIG_TRISTATE");
+ if (!name)
+ name = "include/config/tristate.conf";
+ if (make_parent_dir(name))
+ return 1;
+ if (rename(".tmpconfig_tristate", name))
+ return 1;
+
if (make_parent_dir(autoconf_name))
return 1;
/*
--
2.32.0.255.gd9b1d14a2a
Powered by blists - more mailing lists