modpost: Allow extended modversions without basic MODVERSIONS

If you know that your kernel modules will only ever be loaded by a newer
kernel, you can disable BASIC_MODVERSIONS to save space. This also
allows easy creation of test modules to see how tooling will respond to
modules that only have the new format.

Signed-off-by: Matthew Maurer <mmaurer@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
Matthew Maurer
2025-01-03 17:37:03 +00:00
committed by Masahiro Yamada
parent fc7d5e3210
commit e8639b7ef0
3 changed files with 23 additions and 2 deletions

View File

@@ -33,6 +33,8 @@ static bool module_enabled;
static bool modversions;
/* Is CONFIG_MODULE_SRCVERSION_ALL set? */
static bool all_versions;
/* Is CONFIG_BASIC_MODVERSIONS set? */
static bool basic_modversions;
/* Is CONFIG_EXTENDED_MODVERSIONS set? */
static bool extended_modversions;
/* If we are modposting external module set to 1 */
@@ -1857,7 +1859,7 @@ static void add_versions(struct buffer *b, struct module *mod)
{
struct symbol *s;
if (!modversions)
if (!basic_modversions)
return;
buf_printf(b, "\n");
@@ -2177,7 +2179,7 @@ int main(int argc, char **argv)
LIST_HEAD(dump_lists);
struct dump_list *dl, *dl2;
while ((opt = getopt(argc, argv, "ei:MmnT:to:au:WwENd:x")) != -1) {
while ((opt = getopt(argc, argv, "ei:MmnT:to:au:WwENd:xb")) != -1) {
switch (opt) {
case 'e':
external_module = true;
@@ -2226,6 +2228,9 @@ int main(int argc, char **argv)
case 'd':
missing_namespace_deps = optarg;
break;
case 'b':
basic_modversions = true;
break;
case 'x':
extended_modversions = true;
break;