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:
parent
f1c3d73e97
commit
367948220f
@ -177,7 +177,6 @@ CONFIG_BOOT_PRINTK_DELAY=y
|
||||
CONFIG_DYNAMIC_DEBUG=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
# CONFIG_ENABLE_MUST_CHECK is not set
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_DEBUG_MEMORY_INIT=y
|
||||
CONFIG_LOCKUP_DETECTOR=y
|
||||
CONFIG_SCHED_TRACER=y
|
||||
|
@ -164,7 +164,6 @@ CONFIG_FONTS=y
|
||||
CONFIG_PRINTK_TIME=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
CONFIG_FRAME_WARN=2048
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_MAGIC_SYSRQ=y
|
||||
CONFIG_DEBUG_KERNEL=y
|
||||
CONFIG_SOFTLOCKUP_DETECTOR=y
|
||||
|
@ -549,7 +549,6 @@ CONFIG_PRINTK_TIME=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
# CONFIG_ENABLE_MUST_CHECK is not set
|
||||
CONFIG_FRAME_WARN=1024
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_DEBUG_MEMORY_INIT=y
|
||||
CONFIG_DETECT_HUNG_TASK=y
|
||||
CONFIG_SCHEDSTATS=y
|
||||
|
@ -500,7 +500,6 @@ CONFIG_CRC7=m
|
||||
CONFIG_PRINTK_TIME=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
# CONFIG_ENABLE_MUST_CHECK is not set
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_DEBUG_MEMORY_INIT=y
|
||||
CONFIG_DETECT_HUNG_TASK=y
|
||||
CONFIG_SCHEDSTATS=y
|
||||
|
@ -22,7 +22,6 @@ CONFIG_PCI_LBA=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_MODULE_FORCE_UNLOAD=y
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
# CONFIG_BLK_DEV_BSG is not set
|
||||
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
|
||||
CONFIG_BINFMT_MISC=m
|
||||
|
@ -31,7 +31,6 @@ CONFIG_MODULE_FORCE_LOAD=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_MODULE_FORCE_UNLOAD=y
|
||||
CONFIG_MODVERSIONS=y
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_BLK_DEV_INTEGRITY=y
|
||||
CONFIG_BINFMT_MISC=m
|
||||
# CONFIG_COMPACTION is not set
|
||||
|
@ -1072,7 +1072,6 @@ CONFIG_NLS_ISO8859_15=m
|
||||
CONFIG_NLS_KOI8_R=m
|
||||
CONFIG_NLS_KOI8_U=m
|
||||
CONFIG_DEBUG_INFO=y
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_HEADERS_INSTALL=y
|
||||
CONFIG_MAGIC_SYSRQ=y
|
||||
CONFIG_DEBUG_KERNEL=y
|
||||
|
@ -71,7 +71,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y
|
||||
CONFIG_MODVERSIONS=y
|
||||
CONFIG_MODULE_SRCVERSION_ALL=y
|
||||
CONFIG_MODULE_SIG_SHA256=y
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_BLK_DEV_INTEGRITY=y
|
||||
CONFIG_BLK_DEV_THROTTLING=y
|
||||
CONFIG_BLK_WBT=y
|
||||
|
@ -66,7 +66,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y
|
||||
CONFIG_MODVERSIONS=y
|
||||
CONFIG_MODULE_SRCVERSION_ALL=y
|
||||
CONFIG_MODULE_SIG_SHA256=y
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_BLK_DEV_THROTTLING=y
|
||||
CONFIG_BLK_WBT=y
|
||||
CONFIG_BLK_CGROUP_IOLATENCY=y
|
||||
|
@ -102,7 +102,6 @@ CONFIG_NLS_UTF8=y
|
||||
CONFIG_PRINTK_TIME=y
|
||||
# CONFIG_ENABLE_MUST_CHECK is not set
|
||||
CONFIG_MAGIC_SYSRQ=y
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_DEBUG_KERNEL=y
|
||||
CONFIG_DEBUG_SHIRQ=y
|
||||
CONFIG_DETECT_HUNG_TASK=y
|
||||
|
@ -130,7 +130,6 @@ CONFIG_NLS_ISO8859_15=y
|
||||
CONFIG_NLS_UTF8=y
|
||||
# CONFIG_ENABLE_MUST_CHECK is not set
|
||||
CONFIG_MAGIC_SYSRQ=y
|
||||
CONFIG_UNUSED_SYMBOLS=y
|
||||
CONFIG_DEBUG_KERNEL=y
|
||||
CONFIG_DETECT_HUNG_TASK=y
|
||||
# CONFIG_SCHED_DEBUG is not set
|
||||
|
@ -50,7 +50,6 @@ CONFIG_JUMP_LABEL=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_MODULE_FORCE_UNLOAD=y
|
||||
# CONFIG_UNUSED_SYMBOLS is not set
|
||||
CONFIG_BINFMT_MISC=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_PACKET=y
|
||||
|
@ -48,7 +48,6 @@ CONFIG_JUMP_LABEL=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_MODULE_FORCE_UNLOAD=y
|
||||
# CONFIG_UNUSED_SYMBOLS is not set
|
||||
CONFIG_BINFMT_MISC=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_PACKET=y
|
||||
|
@ -61,8 +61,8 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {
|
||||
"(__iommu_table|__apicdrivers|__smp_locks)(|_end)|"
|
||||
"__(start|end)_pci_.*|"
|
||||
"__(start|end)_builtin_fw|"
|
||||
"__(start|stop)___ksymtab(|_gpl|_unused|_unused_gpl)|"
|
||||
"__(start|stop)___kcrctab(|_gpl|_unused|_unused_gpl)|"
|
||||
"__(start|stop)___ksymtab(|_gpl)|"
|
||||
"__(start|stop)___kcrctab(|_gpl)|"
|
||||
"__(start|stop)___param|"
|
||||
"__(start|stop)___modver|"
|
||||
"__(start|stop)___bug_table|"
|
||||
|
@ -481,20 +481,6 @@
|
||||
__stop___ksymtab_gpl = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: Normal unused symbols */ \
|
||||
__ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
|
||||
__start___ksymtab_unused = .; \
|
||||
KEEP(*(SORT(___ksymtab_unused+*))) \
|
||||
__stop___ksymtab_unused = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only unused symbols */ \
|
||||
__ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
|
||||
__start___ksymtab_unused_gpl = .; \
|
||||
KEEP(*(SORT(___ksymtab_unused_gpl+*))) \
|
||||
__stop___ksymtab_unused_gpl = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: Normal symbols */ \
|
||||
__kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
|
||||
__start___kcrctab = .; \
|
||||
@ -509,20 +495,6 @@
|
||||
__stop___kcrctab_gpl = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: Normal unused symbols */ \
|
||||
__kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
|
||||
__start___kcrctab_unused = .; \
|
||||
KEEP(*(SORT(___kcrctab_unused+*))) \
|
||||
__stop___kcrctab_unused = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only unused symbols */ \
|
||||
__kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
|
||||
__start___kcrctab_unused_gpl = .; \
|
||||
KEEP(*(SORT(___kcrctab_unused_gpl+*))) \
|
||||
__stop___kcrctab_unused_gpl = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: strings */ \
|
||||
__ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
|
||||
*(__ksymtab_strings) \
|
||||
|
@ -160,14 +160,6 @@ struct kernel_symbol {
|
||||
#define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", #ns)
|
||||
#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", #ns)
|
||||
|
||||
#ifdef CONFIG_UNUSED_SYMBOLS
|
||||
#define EXPORT_UNUSED_SYMBOL(sym) _EXPORT_SYMBOL(sym, "_unused")
|
||||
#define EXPORT_UNUSED_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_unused_gpl")
|
||||
#else
|
||||
#define EXPORT_UNUSED_SYMBOL(sym)
|
||||
#define EXPORT_UNUSED_SYMBOL_GPL(sym)
|
||||
#endif
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* _LINUX_EXPORT_H */
|
||||
|
@ -392,18 +392,6 @@ struct module {
|
||||
const s32 *gpl_crcs;
|
||||
bool using_gplonly_symbols;
|
||||
|
||||
#ifdef CONFIG_UNUSED_SYMBOLS
|
||||
/* unused exported symbols. */
|
||||
const struct kernel_symbol *unused_syms;
|
||||
const s32 *unused_crcs;
|
||||
unsigned int num_unused_syms;
|
||||
|
||||
/* GPL-only, unused exported symbols. */
|
||||
unsigned int num_unused_gpl_syms;
|
||||
const struct kernel_symbol *unused_gpl_syms;
|
||||
const s32 *unused_gpl_crcs;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SIG
|
||||
/* Signature was verified. */
|
||||
bool sig_ok;
|
||||
|
17
init/Kconfig
17
init/Kconfig
@ -2262,25 +2262,8 @@ config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config UNUSED_SYMBOLS
|
||||
bool "Enable unused/obsolete exported symbols"
|
||||
default y if X86
|
||||
help
|
||||
Unused but exported symbols make the kernel needlessly bigger. For
|
||||
that reason most of these unused exports will soon be removed. This
|
||||
option is provided temporarily to provide a transition period in case
|
||||
some external kernel module needs one of these symbols anyway. If you
|
||||
encounter such a case in your module, consider if you are actually
|
||||
using the right API. (rationale: since nobody in the kernel is using
|
||||
this in a module, there is a pretty good chance it's actually the
|
||||
wrong interface to use). If you really need the symbol, please send a
|
||||
mail to the linux kernel mailing list mentioning the symbol and why
|
||||
you really need it, and what the merge plan to the mainline kernel for
|
||||
your module is.
|
||||
|
||||
config TRIM_UNUSED_KSYMS
|
||||
bool "Trim unused exported kernel symbols"
|
||||
depends on !UNUSED_SYMBOLS
|
||||
help
|
||||
The kernel and some modules make many symbols available for
|
||||
other modules to use via EXPORT_SYMBOL() and variants. Depending
|
||||
|
@ -410,14 +410,6 @@ extern const struct kernel_symbol __start___ksymtab_gpl[];
|
||||
extern const struct kernel_symbol __stop___ksymtab_gpl[];
|
||||
extern const s32 __start___kcrctab[];
|
||||
extern const s32 __start___kcrctab_gpl[];
|
||||
#ifdef CONFIG_UNUSED_SYMBOLS
|
||||
extern const struct kernel_symbol __start___ksymtab_unused[];
|
||||
extern const struct kernel_symbol __stop___ksymtab_unused[];
|
||||
extern const struct kernel_symbol __start___ksymtab_unused_gpl[];
|
||||
extern const struct kernel_symbol __stop___ksymtab_unused_gpl[];
|
||||
extern const s32 __start___kcrctab_unused[];
|
||||
extern const s32 __start___kcrctab_unused_gpl[];
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MODVERSIONS
|
||||
#define symversion(base, idx) NULL
|
||||
@ -432,7 +424,6 @@ struct symsearch {
|
||||
NOT_GPL_ONLY,
|
||||
GPL_ONLY,
|
||||
} license;
|
||||
bool unused;
|
||||
};
|
||||
|
||||
struct find_symbol_arg {
|
||||
@ -456,19 +447,6 @@ static bool check_exported_symbol(const struct symsearch *syms,
|
||||
|
||||
if (!fsa->gplok && syms->license == GPL_ONLY)
|
||||
return false;
|
||||
|
||||
#ifdef CONFIG_UNUSED_SYMBOLS
|
||||
if (syms->unused && fsa->warn) {
|
||||
pr_warn("Symbol %s is marked as UNUSED, however this module is "
|
||||
"using it.\n", fsa->name);
|
||||
pr_warn("This symbol will go away in the future.\n");
|
||||
pr_warn("Please evaluate if this is the right api to use and "
|
||||
"if it really is, submit a report to the linux kernel "
|
||||
"mailing list together with submitting your code for "
|
||||
"inclusion.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
fsa->owner = owner;
|
||||
fsa->crc = symversion(syms->crcs, symnum);
|
||||
fsa->sym = &syms->start[symnum];
|
||||
@ -535,18 +513,10 @@ static bool find_symbol(struct find_symbol_arg *fsa)
|
||||
{
|
||||
static const struct symsearch arr[] = {
|
||||
{ __start___ksymtab, __stop___ksymtab, __start___kcrctab,
|
||||
NOT_GPL_ONLY, false },
|
||||
NOT_GPL_ONLY },
|
||||
{ __start___ksymtab_gpl, __stop___ksymtab_gpl,
|
||||
__start___kcrctab_gpl,
|
||||
GPL_ONLY, false },
|
||||
#ifdef CONFIG_UNUSED_SYMBOLS
|
||||
{ __start___ksymtab_unused, __stop___ksymtab_unused,
|
||||
__start___kcrctab_unused,
|
||||
NOT_GPL_ONLY, true },
|
||||
{ __start___ksymtab_unused_gpl, __stop___ksymtab_unused_gpl,
|
||||
__start___kcrctab_unused_gpl,
|
||||
GPL_ONLY, true },
|
||||
#endif
|
||||
GPL_ONLY },
|
||||
};
|
||||
struct module *mod;
|
||||
unsigned int i;
|
||||
@ -561,20 +531,10 @@ static bool find_symbol(struct find_symbol_arg *fsa)
|
||||
lockdep_is_held(&module_mutex)) {
|
||||
struct symsearch arr[] = {
|
||||
{ mod->syms, mod->syms + mod->num_syms, mod->crcs,
|
||||
NOT_GPL_ONLY, false },
|
||||
NOT_GPL_ONLY },
|
||||
{ mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms,
|
||||
mod->gpl_crcs,
|
||||
GPL_ONLY, false },
|
||||
#ifdef CONFIG_UNUSED_SYMBOLS
|
||||
{ mod->unused_syms,
|
||||
mod->unused_syms + mod->num_unused_syms,
|
||||
mod->unused_crcs,
|
||||
NOT_GPL_ONLY, true },
|
||||
{ mod->unused_gpl_syms,
|
||||
mod->unused_gpl_syms + mod->num_unused_gpl_syms,
|
||||
mod->unused_gpl_crcs,
|
||||
GPL_ONLY, true },
|
||||
#endif
|
||||
GPL_ONLY },
|
||||
};
|
||||
|
||||
if (mod->state == MODULE_STATE_UNFORMED)
|
||||
@ -2274,10 +2234,6 @@ static int verify_exported_symbols(struct module *mod)
|
||||
} arr[] = {
|
||||
{ mod->syms, mod->num_syms },
|
||||
{ mod->gpl_syms, mod->num_gpl_syms },
|
||||
#ifdef CONFIG_UNUSED_SYMBOLS
|
||||
{ mod->unused_syms, mod->num_unused_syms },
|
||||
{ mod->unused_gpl_syms, mod->num_unused_gpl_syms },
|
||||
#endif
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(arr); i++) {
|
||||
@ -3290,16 +3246,6 @@ static int find_module_sections(struct module *mod, struct load_info *info)
|
||||
&mod->num_gpl_syms);
|
||||
mod->gpl_crcs = section_addr(info, "__kcrctab_gpl");
|
||||
|
||||
#ifdef CONFIG_UNUSED_SYMBOLS
|
||||
mod->unused_syms = section_objs(info, "__ksymtab_unused",
|
||||
sizeof(*mod->unused_syms),
|
||||
&mod->num_unused_syms);
|
||||
mod->unused_crcs = section_addr(info, "__kcrctab_unused");
|
||||
mod->unused_gpl_syms = section_objs(info, "__ksymtab_unused_gpl",
|
||||
sizeof(*mod->unused_gpl_syms),
|
||||
&mod->num_unused_gpl_syms);
|
||||
mod->unused_gpl_crcs = section_addr(info, "__kcrctab_unused_gpl");
|
||||
#endif
|
||||
#ifdef CONFIG_CONSTRUCTORS
|
||||
mod->ctors = section_objs(info, ".ctors",
|
||||
sizeof(*mod->ctors), &mod->num_ctors);
|
||||
@ -3480,13 +3426,8 @@ static int check_module_license_and_versions(struct module *mod)
|
||||
pr_warn("%s: module license taints kernel.\n", mod->name);
|
||||
|
||||
#ifdef CONFIG_MODVERSIONS
|
||||
if ((mod->num_syms && !mod->crcs)
|
||||
|| (mod->num_gpl_syms && !mod->gpl_crcs)
|
||||
#ifdef CONFIG_UNUSED_SYMBOLS
|
||||
|| (mod->num_unused_syms && !mod->unused_crcs)
|
||||
|| (mod->num_unused_gpl_syms && !mod->unused_gpl_crcs)
|
||||
#endif
|
||||
) {
|
||||
if ((mod->num_syms && !mod->crcs) ||
|
||||
(mod->num_gpl_syms && !mod->gpl_crcs)) {
|
||||
return try_to_force_load(mod,
|
||||
"no versions for exported symbols");
|
||||
}
|
||||
|
@ -4290,8 +4290,7 @@ sub process {
|
||||
if (defined $realline_next &&
|
||||
exists $lines[$realline_next - 1] &&
|
||||
!defined $suppress_export{$realline_next} &&
|
||||
($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/ ||
|
||||
$lines[$realline_next - 1] =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
|
||||
($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
|
||||
# Handle definitions which produce identifiers with
|
||||
# a prefix:
|
||||
# XXX(foo);
|
||||
@ -4318,8 +4317,7 @@ sub process {
|
||||
}
|
||||
if (!defined $suppress_export{$linenr} &&
|
||||
$prevline =~ /^.\s*$/ &&
|
||||
($line =~ /EXPORT_SYMBOL.*\((.*)\)/ ||
|
||||
$line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
|
||||
($line =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
|
||||
#print "FOO B <$lines[$linenr - 1]>\n";
|
||||
$suppress_export{$linenr} = 2;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -11,12 +11,8 @@ SECTIONS {
|
||||
|
||||
__ksymtab 0 : { *(SORT(___ksymtab+*)) }
|
||||
__ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) }
|
||||
__ksymtab_unused 0 : { *(SORT(___ksymtab_unused+*)) }
|
||||
__ksymtab_unused_gpl 0 : { *(SORT(___ksymtab_unused_gpl+*)) }
|
||||
__kcrctab 0 : { *(SORT(___kcrctab+*)) }
|
||||
__kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) }
|
||||
__kcrctab_unused 0 : { *(SORT(___kcrctab_unused+*)) }
|
||||
__kcrctab_unused_gpl 0 : { *(SORT(___kcrctab_unused_gpl+*)) }
|
||||
|
||||
.init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
|
||||
|
||||
|
@ -3,7 +3,5 @@
|
||||
|
||||
#define EXPORT_SYMBOL(sym)
|
||||
#define EXPORT_SYMBOL_GPL(sym)
|
||||
#define EXPORT_UNUSED_SYMBOL(sym)
|
||||
#define EXPORT_UNUSED_SYMBOL_GPL(sym)
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user