module: remove EXPORT_UNUSED_SYMBOL*
EXPORT_UNUSED_SYMBOL* is not actually used anywhere. Remove the unused functionality as we generally just remove unused code anyway. Reviewed-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jessica Yu <jeyu@kernel.org>
This commit is contained in:
committed by
Jessica Yu
parent
f1c3d73e97
commit
367948220f
+3
-36
@@ -43,8 +43,9 @@ static int allow_missing_ns_imports;
|
||||
static bool error_occurred;
|
||||
|
||||
enum export {
|
||||
export_plain, export_unused, export_gpl,
|
||||
export_unused_gpl, export_unknown
|
||||
export_plain,
|
||||
export_gpl,
|
||||
export_unknown
|
||||
};
|
||||
|
||||
/* In kernel, this size is defined in linux/module.h;
|
||||
@@ -301,9 +302,7 @@ static const struct {
|
||||
enum export export;
|
||||
} export_list[] = {
|
||||
{ .str = "EXPORT_SYMBOL", .export = export_plain },
|
||||
{ .str = "EXPORT_UNUSED_SYMBOL", .export = export_unused },
|
||||
{ .str = "EXPORT_SYMBOL_GPL", .export = export_gpl },
|
||||
{ .str = "EXPORT_UNUSED_SYMBOL_GPL", .export = export_unused_gpl },
|
||||
{ .str = "(unknown)", .export = export_unknown },
|
||||
};
|
||||
|
||||
@@ -362,12 +361,8 @@ static enum export export_from_secname(struct elf_info *elf, unsigned int sec)
|
||||
|
||||
if (strstarts(secname, "___ksymtab+"))
|
||||
return export_plain;
|
||||
else if (strstarts(secname, "___ksymtab_unused+"))
|
||||
return export_unused;
|
||||
else if (strstarts(secname, "___ksymtab_gpl+"))
|
||||
return export_gpl;
|
||||
else if (strstarts(secname, "___ksymtab_unused_gpl+"))
|
||||
return export_unused_gpl;
|
||||
else
|
||||
return export_unknown;
|
||||
}
|
||||
@@ -376,12 +371,8 @@ static enum export export_from_sec(struct elf_info *elf, unsigned int sec)
|
||||
{
|
||||
if (sec == elf->export_sec)
|
||||
return export_plain;
|
||||
else if (sec == elf->export_unused_sec)
|
||||
return export_unused;
|
||||
else if (sec == elf->export_gpl_sec)
|
||||
return export_gpl;
|
||||
else if (sec == elf->export_unused_gpl_sec)
|
||||
return export_unused_gpl;
|
||||
else
|
||||
return export_unknown;
|
||||
}
|
||||
@@ -585,12 +576,8 @@ static int parse_elf(struct elf_info *info, const char *filename)
|
||||
info->modinfo_len = sechdrs[i].sh_size;
|
||||
} else if (strcmp(secname, "__ksymtab") == 0)
|
||||
info->export_sec = i;
|
||||
else if (strcmp(secname, "__ksymtab_unused") == 0)
|
||||
info->export_unused_sec = i;
|
||||
else if (strcmp(secname, "__ksymtab_gpl") == 0)
|
||||
info->export_gpl_sec = i;
|
||||
else if (strcmp(secname, "__ksymtab_unused_gpl") == 0)
|
||||
info->export_unused_gpl_sec = i;
|
||||
|
||||
if (sechdrs[i].sh_type == SHT_SYMTAB) {
|
||||
unsigned int sh_link_idx;
|
||||
@@ -2141,32 +2128,13 @@ static void check_for_gpl_usage(enum export exp, const char *m, const char *s)
|
||||
error("GPL-incompatible module %s.ko uses GPL-only symbol '%s'\n",
|
||||
m, s);
|
||||
break;
|
||||
case export_unused_gpl:
|
||||
error("GPL-incompatible module %s.ko uses GPL-only symbol marked UNUSED '%s'\n",
|
||||
m, s);
|
||||
break;
|
||||
case export_plain:
|
||||
case export_unused:
|
||||
case export_unknown:
|
||||
/* ignore */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void check_for_unused(enum export exp, const char *m, const char *s)
|
||||
{
|
||||
switch (exp) {
|
||||
case export_unused:
|
||||
case export_unused_gpl:
|
||||
warn("module %s.ko uses symbol '%s' marked UNUSED\n",
|
||||
m, s);
|
||||
break;
|
||||
default:
|
||||
/* ignore */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void check_exports(struct module *mod)
|
||||
{
|
||||
struct symbol *s, *exp;
|
||||
@@ -2197,7 +2165,6 @@ static void check_exports(struct module *mod)
|
||||
|
||||
if (!mod->gpl_compatible)
|
||||
check_for_gpl_usage(exp->export, basename, exp->name);
|
||||
check_for_unused(exp->export, basename, exp->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,9 +139,7 @@ struct elf_info {
|
||||
Elf_Sym *symtab_start;
|
||||
Elf_Sym *symtab_stop;
|
||||
Elf_Section export_sec;
|
||||
Elf_Section export_unused_sec;
|
||||
Elf_Section export_gpl_sec;
|
||||
Elf_Section export_unused_gpl_sec;
|
||||
char *strtab;
|
||||
char *modinfo;
|
||||
unsigned int modinfo_len;
|
||||
|
||||
Reference in New Issue
Block a user