Commit 4ddea2f8 authored by Masahiro Yamada's avatar Masahiro Yamada

modpost: do not call get_modinfo() for vmlinux(.o)

The three calls of get_modinfo() ("license", "import_ns", "version")
always return NULL for vmlinux(.o) because the built-in module info is
prefixed with __MODULE_INFO_PREFIX.

It is harmless to call get_modinfo(), but there is no point to search
for what apparently does not exist.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent f6931535
...@@ -2006,25 +2006,26 @@ static void read_symbols(const char *modname) ...@@ -2006,25 +2006,26 @@ static void read_symbols(const char *modname)
mod->skip = 1; mod->skip = 1;
} }
license = get_modinfo(&info, "license"); if (!is_vmlinux(modname)) {
if (!license && !is_vmlinux(modname)) license = get_modinfo(&info, "license");
warn("missing MODULE_LICENSE() in %s\n" if (!license)
"see include/linux/module.h for " warn("missing MODULE_LICENSE() in %s\n", modname);
"more information\n", modname); while (license) {
while (license) { if (license_is_gpl_compatible(license))
if (license_is_gpl_compatible(license)) mod->gpl_compatible = 1;
mod->gpl_compatible = 1; else {
else { mod->gpl_compatible = 0;
mod->gpl_compatible = 0; break;
break; }
license = get_next_modinfo(&info, "license", license);
} }
license = get_next_modinfo(&info, "license", license);
}
namespace = get_modinfo(&info, "import_ns"); namespace = get_modinfo(&info, "import_ns");
while (namespace) { while (namespace) {
add_namespace(&mod->imported_namespaces, namespace); add_namespace(&mod->imported_namespaces, namespace);
namespace = get_next_modinfo(&info, "import_ns", namespace); namespace = get_next_modinfo(&info, "import_ns",
namespace);
}
} }
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
...@@ -2065,10 +2066,12 @@ static void read_symbols(const char *modname) ...@@ -2065,10 +2066,12 @@ static void read_symbols(const char *modname)
if (!is_vmlinux(modname) || vmlinux_section_warnings) if (!is_vmlinux(modname) || vmlinux_section_warnings)
check_sec_ref(mod, modname, &info); check_sec_ref(mod, modname, &info);
version = get_modinfo(&info, "version"); if (!is_vmlinux(modname)) {
if (version || (all_versions && !is_vmlinux(modname))) version = get_modinfo(&info, "version");
get_src_version(modname, mod->srcversion, if (version || all_versions)
sizeof(mod->srcversion)-1); get_src_version(modname, mod->srcversion,
sizeof(mod->srcversion) - 1);
}
parse_elf_finish(&info); parse_elf_finish(&info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment