History

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.

Christoph Hellwig committed 5 years ago

Commit 36794821 parent f1c3d7324 files · +13 −193Browse files

Unified · Split

24 files
  1. arch/arm/configs/bcm2835_defconfig +0 −1
  2. arch/arm/configs/mxs_defconfig +0 −1
  3. arch/mips/configs/nlm_xlp_defconfig +0 −1
  4. arch/mips/configs/nlm_xlr_defconfig +0 −1
  5. arch/parisc/configs/generic-32bit_defconfig +0 −1
  6. arch/parisc/configs/generic-64bit_defconfig +0 −1
  7. arch/powerpc/configs/ppc6xx_defconfig +0 −1
  8. arch/s390/configs/debug_defconfig +0 −1
  9. arch/s390/configs/defconfig +0 −1
  10. arch/sh/configs/edosk7760_defconfig +0 −1
  11. arch/sh/configs/sdk7780_defconfig +0 −1
  12. arch/x86/configs/i386_defconfig +0 −1
  13. arch/x86/configs/x86_64_defconfig +0 −1
  14. arch/x86/tools/relocs.c +2 −2
  15. include/asm-generic/vmlinux.lds.h +0 −28
  16. include/linux/export.h +0 −8
  17. include/linux/module.h +0 −12
  18. init/Kconfig +0 −17
  19. kernel/module.c +6 −65
  20. scripts/checkpatch.pl +2 −4
  21. scripts/mod/modpost.c +3 −36
  22. scripts/mod/modpost.h +0 −2
  23. scripts/module.lds.S +0 −4
  24. tools/include/linux/export.h +0 −2
arch/arm/configs/bcm2835_defconfig+0−1
@@ -177,7 +177,6 @@ CONFIG_BOOT_PRINTK_DELAY=y · 176 unmodified lines
177CONFIG_DYNAMIC_DEBUG=y177CONFIG_DYNAMIC_DEBUG=y
178CONFIG_DEBUG_INFO=y178CONFIG_DEBUG_INFO=y
179# CONFIG_ENABLE_MUST_CHECK is not set179# CONFIG_ENABLE_MUST_CHECK is not set
180CONFIG_UNUSED_SYMBOLS=y
181CONFIG_DEBUG_MEMORY_INIT=y180CONFIG_DEBUG_MEMORY_INIT=y
182CONFIG_LOCKUP_DETECTOR=y181CONFIG_LOCKUP_DETECTOR=y
183CONFIG_SCHED_TRACER=y182CONFIG_SCHED_TRACER=y
arch/arm/configs/mxs_defconfig+0−1
@@ -164,7 +164,6 @@ CONFIG_FONTS=y · 163 unmodified lines
164CONFIG_PRINTK_TIME=y164CONFIG_PRINTK_TIME=y
165CONFIG_DEBUG_INFO=y165CONFIG_DEBUG_INFO=y
166CONFIG_FRAME_WARN=2048166CONFIG_FRAME_WARN=2048
167CONFIG_UNUSED_SYMBOLS=y
168CONFIG_MAGIC_SYSRQ=y167CONFIG_MAGIC_SYSRQ=y
169CONFIG_DEBUG_KERNEL=y168CONFIG_DEBUG_KERNEL=y
170CONFIG_SOFTLOCKUP_DETECTOR=y169CONFIG_SOFTLOCKUP_DETECTOR=y
arch/mips/configs/nlm_xlp_defconfig+0−1
@@ -549,7 +549,6 @@ CONFIG_PRINTK_TIME=y · 548 unmodified lines
549CONFIG_DEBUG_INFO=y549CONFIG_DEBUG_INFO=y
550# CONFIG_ENABLE_MUST_CHECK is not set550# CONFIG_ENABLE_MUST_CHECK is not set
551CONFIG_FRAME_WARN=1024551CONFIG_FRAME_WARN=1024
552CONFIG_UNUSED_SYMBOLS=y
553CONFIG_DEBUG_MEMORY_INIT=y552CONFIG_DEBUG_MEMORY_INIT=y
554CONFIG_DETECT_HUNG_TASK=y553CONFIG_DETECT_HUNG_TASK=y
555CONFIG_SCHEDSTATS=y554CONFIG_SCHEDSTATS=y
arch/mips/configs/nlm_xlr_defconfig+0−1
@@ -500,7 +500,6 @@ CONFIG_CRC7=m · 499 unmodified lines
500CONFIG_PRINTK_TIME=y500CONFIG_PRINTK_TIME=y
501CONFIG_DEBUG_INFO=y501CONFIG_DEBUG_INFO=y
502# CONFIG_ENABLE_MUST_CHECK is not set502# CONFIG_ENABLE_MUST_CHECK is not set
503CONFIG_UNUSED_SYMBOLS=y
504CONFIG_DEBUG_MEMORY_INIT=y503CONFIG_DEBUG_MEMORY_INIT=y
505CONFIG_DETECT_HUNG_TASK=y504CONFIG_DETECT_HUNG_TASK=y
506CONFIG_SCHEDSTATS=y505CONFIG_SCHEDSTATS=y
arch/parisc/configs/generic-32bit_defconfig+0−1
@@ -22,7 +22,6 @@ CONFIG_PCI_LBA=y · 21 unmodified lines
22CONFIG_MODULES=y22CONFIG_MODULES=y
23CONFIG_MODULE_UNLOAD=y23CONFIG_MODULE_UNLOAD=y
24CONFIG_MODULE_FORCE_UNLOAD=y24CONFIG_MODULE_FORCE_UNLOAD=y
25CONFIG_UNUSED_SYMBOLS=y
26# CONFIG_BLK_DEV_BSG is not set25# CONFIG_BLK_DEV_BSG is not set
27# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set26# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
28CONFIG_BINFMT_MISC=m27CONFIG_BINFMT_MISC=m
arch/parisc/configs/generic-64bit_defconfig+0−1
@@ -31,7 +31,6 @@ CONFIG_MODULE_FORCE_LOAD=y · 30 unmodified lines
31CONFIG_MODULE_UNLOAD=y31CONFIG_MODULE_UNLOAD=y
32CONFIG_MODULE_FORCE_UNLOAD=y32CONFIG_MODULE_FORCE_UNLOAD=y
33CONFIG_MODVERSIONS=y33CONFIG_MODVERSIONS=y
34CONFIG_UNUSED_SYMBOLS=y
35CONFIG_BLK_DEV_INTEGRITY=y34CONFIG_BLK_DEV_INTEGRITY=y
36CONFIG_BINFMT_MISC=m35CONFIG_BINFMT_MISC=m
37# CONFIG_COMPACTION is not set36# CONFIG_COMPACTION is not set
arch/powerpc/configs/ppc6xx_defconfig+0−1
@@ -1072,7 +1072,6 @@ CONFIG_NLS_ISO8859_15=m · 1071 unmodified lines
1072CONFIG_NLS_KOI8_R=m1072CONFIG_NLS_KOI8_R=m
1073CONFIG_NLS_KOI8_U=m1073CONFIG_NLS_KOI8_U=m
1074CONFIG_DEBUG_INFO=y1074CONFIG_DEBUG_INFO=y
1075CONFIG_UNUSED_SYMBOLS=y
1076CONFIG_HEADERS_INSTALL=y1075CONFIG_HEADERS_INSTALL=y
1077CONFIG_MAGIC_SYSRQ=y1076CONFIG_MAGIC_SYSRQ=y
1078CONFIG_DEBUG_KERNEL=y1077CONFIG_DEBUG_KERNEL=y
arch/s390/configs/debug_defconfig+0−1
@@ -71,7 +71,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y · 70 unmodified lines
71CONFIG_MODVERSIONS=y71CONFIG_MODVERSIONS=y
72CONFIG_MODULE_SRCVERSION_ALL=y72CONFIG_MODULE_SRCVERSION_ALL=y
73CONFIG_MODULE_SIG_SHA256=y73CONFIG_MODULE_SIG_SHA256=y
74CONFIG_UNUSED_SYMBOLS=y
75CONFIG_BLK_DEV_INTEGRITY=y74CONFIG_BLK_DEV_INTEGRITY=y
76CONFIG_BLK_DEV_THROTTLING=y75CONFIG_BLK_DEV_THROTTLING=y
77CONFIG_BLK_WBT=y76CONFIG_BLK_WBT=y
arch/s390/configs/defconfig+0−1
@@ -66,7 +66,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y · 65 unmodified lines
66CONFIG_MODVERSIONS=y66CONFIG_MODVERSIONS=y
67CONFIG_MODULE_SRCVERSION_ALL=y67CONFIG_MODULE_SRCVERSION_ALL=y
68CONFIG_MODULE_SIG_SHA256=y68CONFIG_MODULE_SIG_SHA256=y
69CONFIG_UNUSED_SYMBOLS=y
70CONFIG_BLK_DEV_THROTTLING=y69CONFIG_BLK_DEV_THROTTLING=y
71CONFIG_BLK_WBT=y70CONFIG_BLK_WBT=y
72CONFIG_BLK_CGROUP_IOLATENCY=y71CONFIG_BLK_CGROUP_IOLATENCY=y
arch/sh/configs/edosk7760_defconfig+0−1
@@ -102,7 +102,6 @@ CONFIG_NLS_UTF8=y · 101 unmodified lines
102CONFIG_PRINTK_TIME=y102CONFIG_PRINTK_TIME=y
103# CONFIG_ENABLE_MUST_CHECK is not set103# CONFIG_ENABLE_MUST_CHECK is not set
104CONFIG_MAGIC_SYSRQ=y104CONFIG_MAGIC_SYSRQ=y
105CONFIG_UNUSED_SYMBOLS=y
106CONFIG_DEBUG_KERNEL=y105CONFIG_DEBUG_KERNEL=y
107CONFIG_DEBUG_SHIRQ=y106CONFIG_DEBUG_SHIRQ=y
108CONFIG_DETECT_HUNG_TASK=y107CONFIG_DETECT_HUNG_TASK=y
arch/sh/configs/sdk7780_defconfig+0−1
@@ -130,7 +130,6 @@ CONFIG_NLS_ISO8859_15=y · 129 unmodified lines
130CONFIG_NLS_UTF8=y130CONFIG_NLS_UTF8=y
131# CONFIG_ENABLE_MUST_CHECK is not set131# CONFIG_ENABLE_MUST_CHECK is not set
132CONFIG_MAGIC_SYSRQ=y132CONFIG_MAGIC_SYSRQ=y
133CONFIG_UNUSED_SYMBOLS=y
134CONFIG_DEBUG_KERNEL=y133CONFIG_DEBUG_KERNEL=y
135CONFIG_DETECT_HUNG_TASK=y134CONFIG_DETECT_HUNG_TASK=y
136# CONFIG_SCHED_DEBUG is not set135# CONFIG_SCHED_DEBUG is not set
arch/x86/configs/i386_defconfig+0−1
@@ -50,7 +50,6 @@ CONFIG_JUMP_LABEL=y · 49 unmodified lines
50CONFIG_MODULES=y50CONFIG_MODULES=y
51CONFIG_MODULE_UNLOAD=y51CONFIG_MODULE_UNLOAD=y
52CONFIG_MODULE_FORCE_UNLOAD=y52CONFIG_MODULE_FORCE_UNLOAD=y
53# CONFIG_UNUSED_SYMBOLS is not set
54CONFIG_BINFMT_MISC=y53CONFIG_BINFMT_MISC=y
55CONFIG_NET=y54CONFIG_NET=y
56CONFIG_PACKET=y55CONFIG_PACKET=y
arch/x86/configs/x86_64_defconfig+0−1
@@ -48,7 +48,6 @@ CONFIG_JUMP_LABEL=y · 47 unmodified lines
48CONFIG_MODULES=y48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y49CONFIG_MODULE_UNLOAD=y
50CONFIG_MODULE_FORCE_UNLOAD=y50CONFIG_MODULE_FORCE_UNLOAD=y
51# CONFIG_UNUSED_SYMBOLS is not set
52CONFIG_BINFMT_MISC=y51CONFIG_BINFMT_MISC=y
53CONFIG_NET=y52CONFIG_NET=y
54CONFIG_PACKET=y53CONFIG_PACKET=y
arch/x86/tools/relocs.c+2−2
@@ -61,8 +61,8 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = { · 60 unmodified lines
61 "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|"61 "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|"
62 "__(start|end)_pci_.*|"62 "__(start|end)_pci_.*|"
63 "__(start|end)_builtin_fw|"63 "__(start|end)_builtin_fw|"
64 "__(start|stop)___ksymtab(|_gpl|_unused|_unused_gpl)|"64 "__(start|stop)___ksymtab(|_gpl)|"
65 "__(start|stop)___kcrctab(|_gpl|_unused|_unused_gpl)|"65 "__(start|stop)___kcrctab(|_gpl)|"
66 "__(start|stop)___param|"66 "__(start|stop)___param|"
67 "__(start|stop)___modver|"67 "__(start|stop)___modver|"
68 "__(start|stop)___bug_table|"68 "__(start|stop)___bug_table|"
include/asm-generic/vmlinux.lds.h+0−28
@@ -481,20 +481,6 @@ · 480 unmodified lines
481 __stop___ksymtab_gpl = .; \481 __stop___ksymtab_gpl = .; \
482 } \482 } \
483 \483 \
484 /* Kernel symbol table: Normal unused symbols */ \
485 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
486 __start___ksymtab_unused = .; \
487 KEEP(*(SORT(___ksymtab_unused+*))) \
488 __stop___ksymtab_unused = .; \
489 } \
490 \
491 /* Kernel symbol table: GPL-only unused symbols */ \
492 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
493 __start___ksymtab_unused_gpl = .; \
494 KEEP(*(SORT(___ksymtab_unused_gpl+*))) \
495 __stop___ksymtab_unused_gpl = .; \
496 } \
497 \
498 /* Kernel symbol table: Normal symbols */ \484 /* Kernel symbol table: Normal symbols */ \
499 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \485 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
500 __start___kcrctab = .; \486 __start___kcrctab = .; \
@@ -509,20 +495,6 @@ · 8 unmodified lines
509 __stop___kcrctab_gpl = .; \495 __stop___kcrctab_gpl = .; \
510 } \496 } \
511 \497 \
512 /* Kernel symbol table: Normal unused symbols */ \
513 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
514 __start___kcrctab_unused = .; \
515 KEEP(*(SORT(___kcrctab_unused+*))) \
516 __stop___kcrctab_unused = .; \
517 } \
518 \
519 /* Kernel symbol table: GPL-only unused symbols */ \
520 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
521 __start___kcrctab_unused_gpl = .; \
522 KEEP(*(SORT(___kcrctab_unused_gpl+*))) \
523 __stop___kcrctab_unused_gpl = .; \
524 } \
525 \
526 /* Kernel symbol table: strings */ \498 /* Kernel symbol table: strings */ \
527 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \499 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
528 *(__ksymtab_strings) \500 *(__ksymtab_strings) \
include/linux/export.h+0−8
@@ -160,14 +160,6 @@ struct kernel_symbol { · 159 unmodified lines
160#define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", #ns)160#define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", #ns)
161#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", #ns)161#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", #ns)
162 162
163#ifdef CONFIG_UNUSED_SYMBOLS
164#define EXPORT_UNUSED_SYMBOL(sym) _EXPORT_SYMBOL(sym, "_unused")
165#define EXPORT_UNUSED_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_unused_gpl")
166#else
167#define EXPORT_UNUSED_SYMBOL(sym)
168#define EXPORT_UNUSED_SYMBOL_GPL(sym)
169#endif
170
171#endif /* !__ASSEMBLY__ */163#endif /* !__ASSEMBLY__ */
172 164
173#endif /* _LINUX_EXPORT_H */165#endif /* _LINUX_EXPORT_H */
include/linux/module.h+0−12
@@ -392,18 +392,6 @@ struct module { · 391 unmodified lines
392 const s32 *gpl_crcs;392 const s32 *gpl_crcs;
393 bool using_gplonly_symbols;393 bool using_gplonly_symbols;
394 394
395#ifdef CONFIG_UNUSED_SYMBOLS
396 /* unused exported symbols. */
397 const struct kernel_symbol *unused_syms;
398 const s32 *unused_crcs;
399 unsigned int num_unused_syms;
400
401 /* GPL-only, unused exported symbols. */
402 unsigned int num_unused_gpl_syms;
403 const struct kernel_symbol *unused_gpl_syms;
404 const s32 *unused_gpl_crcs;
405#endif
406
407#ifdef CONFIG_MODULE_SIG395#ifdef CONFIG_MODULE_SIG
408 /* Signature was verified. */396 /* Signature was verified. */
409 bool sig_ok;397 bool sig_ok;
init/Kconfig+0−17
@@ -2262,25 +2262,8 @@ config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS · 2261 unmodified lines
2262 2262
2263 If unsure, say N.2263 If unsure, say N.
2264 2264
2265config UNUSED_SYMBOLS
2266 bool "Enable unused/obsolete exported symbols"
2267 default y if X86
2268 help
2269 Unused but exported symbols make the kernel needlessly bigger. For
2270 that reason most of these unused exports will soon be removed. This
2271 option is provided temporarily to provide a transition period in case
2272 some external kernel module needs one of these symbols anyway. If you
2273 encounter such a case in your module, consider if you are actually
2274 using the right API. (rationale: since nobody in the kernel is using
2275 this in a module, there is a pretty good chance it's actually the
2276 wrong interface to use). If you really need the symbol, please send a
2277 mail to the linux kernel mailing list mentioning the symbol and why
2278 you really need it, and what the merge plan to the mainline kernel for
2279 your module is.
2280
2281config TRIM_UNUSED_KSYMS2265config TRIM_UNUSED_KSYMS
2282 bool "Trim unused exported kernel symbols"2266 bool "Trim unused exported kernel symbols"
2283 depends on !UNUSED_SYMBOLS
2284 help2267 help
2285 The kernel and some modules make many symbols available for2268 The kernel and some modules make many symbols available for
2286 other modules to use via EXPORT_SYMBOL() and variants. Depending2269 other modules to use via EXPORT_SYMBOL() and variants. Depending
kernel/module.c+6−65
@@ -410,14 +410,6 @@ extern const struct kernel_symbol __start___ksymtab_gpl[]; · 409 unmodified lines
410extern const struct kernel_symbol __stop___ksymtab_gpl[];410extern const struct kernel_symbol __stop___ksymtab_gpl[];
411extern const s32 __start___kcrctab[];411extern const s32 __start___kcrctab[];
412extern const s32 __start___kcrctab_gpl[];412extern const s32 __start___kcrctab_gpl[];
413#ifdef CONFIG_UNUSED_SYMBOLS
414extern const struct kernel_symbol __start___ksymtab_unused[];
415extern const struct kernel_symbol __stop___ksymtab_unused[];
416extern const struct kernel_symbol __start___ksymtab_unused_gpl[];
417extern const struct kernel_symbol __stop___ksymtab_unused_gpl[];
418extern const s32 __start___kcrctab_unused[];
419extern const s32 __start___kcrctab_unused_gpl[];
420#endif
421 413
422#ifndef CONFIG_MODVERSIONS414#ifndef CONFIG_MODVERSIONS
423#define symversion(base, idx) NULL415#define symversion(base, idx) NULL
@@ -432,7 +424,6 @@ struct symsearch { · 8 unmodified lines
432 NOT_GPL_ONLY,424 NOT_GPL_ONLY,
433 GPL_ONLY,425 GPL_ONLY,
434 } license;426 } license;
435 bool unused;
436};427};
437 428
438struct find_symbol_arg {429struct find_symbol_arg {
@@ -456,19 +447,6 @@ static bool check_exported_symbol(const struct symsearch *syms, · 17 unmodified lines
456 447
457 if (!fsa->gplok && syms->license == GPL_ONLY)448 if (!fsa->gplok && syms->license == GPL_ONLY)
458 return false;449 return false;
459
460#ifdef CONFIG_UNUSED_SYMBOLS
461 if (syms->unused && fsa->warn) {
462 pr_warn("Symbol %s is marked as UNUSED, however this module is "
463 "using it.\n", fsa->name);
464 pr_warn("This symbol will go away in the future.\n");
465 pr_warn("Please evaluate if this is the right api to use and "
466 "if it really is, submit a report to the linux kernel "
467 "mailing list together with submitting your code for "
468 "inclusion.\n");
469 }
470#endif
471
472 fsa->owner = owner;450 fsa->owner = owner;
473 fsa->crc = symversion(syms->crcs, symnum);451 fsa->crc = symversion(syms->crcs, symnum);
474 fsa->sym = &syms->start[symnum];452 fsa->sym = &syms->start[symnum];
@@ -535,18 +513,10 @@ static bool find_symbol(struct find_symbol_arg *fsa) · 60 unmodified lines
535{513{
536 static const struct symsearch arr[] = {514 static const struct symsearch arr[] = {
537 { __start___ksymtab, __stop___ksymtab, __start___kcrctab,515 { __start___ksymtab, __stop___ksymtab, __start___kcrctab,
538 NOT_GPL_ONLY, false },516 NOT_GPL_ONLY },
539 { __start___ksymtab_gpl, __stop___ksymtab_gpl,517 { __start___ksymtab_gpl, __stop___ksymtab_gpl,
540 __start___kcrctab_gpl,518 __start___kcrctab_gpl,
541 GPL_ONLY, false },519 GPL_ONLY },
542#ifdef CONFIG_UNUSED_SYMBOLS
543 { __start___ksymtab_unused, __stop___ksymtab_unused,
544 __start___kcrctab_unused,
545 NOT_GPL_ONLY, true },
546 { __start___ksymtab_unused_gpl, __stop___ksymtab_unused_gpl,
547 __start___kcrctab_unused_gpl,
548 GPL_ONLY, true },
549#endif
550 };520 };
551 struct module *mod;521 struct module *mod;
552 unsigned int i;522 unsigned int i;
@@ -561,20 +531,10 @@ static bool find_symbol(struct find_symbol_arg *fsa) · 8 unmodified lines
561 lockdep_is_held(&module_mutex)) {531 lockdep_is_held(&module_mutex)) {
562 struct symsearch arr[] = {532 struct symsearch arr[] = {
563 { mod->syms, mod->syms + mod->num_syms, mod->crcs,533 { mod->syms, mod->syms + mod->num_syms, mod->crcs,
564 NOT_GPL_ONLY, false },534 NOT_GPL_ONLY },
565 { mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms,535 { mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms,
566 mod->gpl_crcs,536 mod->gpl_crcs,
567 GPL_ONLY, false },537 GPL_ONLY },
568#ifdef CONFIG_UNUSED_SYMBOLS
569 { mod->unused_syms,
570 mod->unused_syms + mod->num_unused_syms,
571 mod->unused_crcs,
572 NOT_GPL_ONLY, true },
573 { mod->unused_gpl_syms,
574 mod->unused_gpl_syms + mod->num_unused_gpl_syms,
575 mod->unused_gpl_crcs,
576 GPL_ONLY, true },
577#endif
578 };538 };
579 539
580 if (mod->state == MODULE_STATE_UNFORMED)540 if (mod->state == MODULE_STATE_UNFORMED)
@@ -2274,10 +2234,6 @@ static int verify_exported_symbols(struct module *mod) · 1693 unmodified lines
2274 } arr[] = {2234 } arr[] = {
2275 { mod->syms, mod->num_syms },2235 { mod->syms, mod->num_syms },
2276 { mod->gpl_syms, mod->num_gpl_syms },2236 { mod->gpl_syms, mod->num_gpl_syms },
2277#ifdef CONFIG_UNUSED_SYMBOLS
2278 { mod->unused_syms, mod->num_unused_syms },
2279 { mod->unused_gpl_syms, mod->num_unused_gpl_syms },
2280#endif
2281 };2237 };
2282 2238
2283 for (i = 0; i < ARRAY_SIZE(arr); i++) {2239 for (i = 0; i < ARRAY_SIZE(arr); i++) {
@@ -3290,16 +3246,6 @@ static int find_module_sections(struct module *mod, struct load_info *info) · 1006 unmodified lines
3290 &mod->num_gpl_syms);3246 &mod->num_gpl_syms);
3291 mod->gpl_crcs = section_addr(info, "__kcrctab_gpl");3247 mod->gpl_crcs = section_addr(info, "__kcrctab_gpl");
3292 3248
3293#ifdef CONFIG_UNUSED_SYMBOLS
3294 mod->unused_syms = section_objs(info, "__ksymtab_unused",
3295 sizeof(*mod->unused_syms),
3296 &mod->num_unused_syms);
3297 mod->unused_crcs = section_addr(info, "__kcrctab_unused");
3298 mod->unused_gpl_syms = section_objs(info, "__ksymtab_unused_gpl",
3299 sizeof(*mod->unused_gpl_syms),
3300 &mod->num_unused_gpl_syms);
3301 mod->unused_gpl_crcs = section_addr(info, "__kcrctab_unused_gpl");
3302#endif
3303#ifdef CONFIG_CONSTRUCTORS3249#ifdef CONFIG_CONSTRUCTORS
3304 mod->ctors = section_objs(info, ".ctors",3250 mod->ctors = section_objs(info, ".ctors",
3305 sizeof(*mod->ctors), &mod->num_ctors);3251 sizeof(*mod->ctors), &mod->num_ctors);
@@ -3480,13 +3426,8 @@ static int check_module_license_and_versions(struct module *mod) · 174 unmodified lines
3480 pr_warn("%s: module license taints kernel.\n", mod->name);3426 pr_warn("%s: module license taints kernel.\n", mod->name);
3481 3427
3482#ifdef CONFIG_MODVERSIONS3428#ifdef CONFIG_MODVERSIONS
3483 if ((mod->num_syms && !mod->crcs)3429 if ((mod->num_syms && !mod->crcs) ||
3484 || (mod->num_gpl_syms && !mod->gpl_crcs)3430 (mod->num_gpl_syms && !mod->gpl_crcs)) {
3485#ifdef CONFIG_UNUSED_SYMBOLS
3486 || (mod->num_unused_syms && !mod->unused_crcs)
3487 || (mod->num_unused_gpl_syms && !mod->unused_gpl_crcs)
3488#endif
3489 ) {
3490 return try_to_force_load(mod,3431 return try_to_force_load(mod,
3491 "no versions for exported symbols");3432 "no versions for exported symbols");
3492 }3433 }
scripts/checkpatch.pl+2−4
@@ -4290,8 +4290,7 @@ sub process { · 4289 unmodified lines
4290 if (defined $realline_next &&4290 if (defined $realline_next &&
4291 exists $lines[$realline_next - 1] &&4291 exists $lines[$realline_next - 1] &&
4292 !defined $suppress_export{$realline_next} &&4292 !defined $suppress_export{$realline_next} &&
4293 ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/ ||4293 ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
4294 $lines[$realline_next - 1] =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
4295 # Handle definitions which produce identifiers with4294 # Handle definitions which produce identifiers with
4296 # a prefix:4295 # a prefix:
4297 # XXX(foo);4296 # XXX(foo);
@@ -4318,8 +4317,7 @@ sub process { · 20 unmodified lines
4318 }4317 }
4319 if (!defined $suppress_export{$linenr} &&4318 if (!defined $suppress_export{$linenr} &&
4320 $prevline =~ /^.\s*$/ &&4319 $prevline =~ /^.\s*$/ &&
4321 ($line =~ /EXPORT_SYMBOL.*\((.*)\)/ ||4320 ($line =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
4322 $line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
4323#print "FOO B <$lines[$linenr - 1]>\n";4321#print "FOO B <$lines[$linenr - 1]>\n";
4324 $suppress_export{$linenr} = 2;4322 $suppress_export{$linenr} = 2;
4325 }4323 }
scripts/mod/modpost.c+3−36
@@ -43,8 +43,9 @@ static int allow_missing_ns_imports; · 42 unmodified lines
43static bool error_occurred;43static bool error_occurred;
44 44
45enum export {45enum export {
46 export_plain, export_unused, export_gpl,46 export_plain,
47 export_unused_gpl, export_unknown47 export_gpl,
48 export_unknown
48};49};
49 50
50/* In kernel, this size is defined in linux/module.h;51/* In kernel, this size is defined in linux/module.h;
@@ -301,9 +302,7 @@ static const struct { · 250 unmodified lines
301 enum export export;302 enum export export;
302} export_list[] = {303} export_list[] = {
303 { .str = "EXPORT_SYMBOL", .export = export_plain },304 { .str = "EXPORT_SYMBOL", .export = export_plain },
304 { .str = "EXPORT_UNUSED_SYMBOL", .export = export_unused },
305 { .str = "EXPORT_SYMBOL_GPL", .export = export_gpl },305 { .str = "EXPORT_SYMBOL_GPL", .export = export_gpl },
306 { .str = "EXPORT_UNUSED_SYMBOL_GPL", .export = export_unused_gpl },
307 { .str = "(unknown)", .export = export_unknown },306 { .str = "(unknown)", .export = export_unknown },
308};307};
309 308
@@ -362,12 +361,8 @@ static enum export export_from_secname(struct elf_info *elf, unsigned int sec) · 52 unmodified lines
362 361
363 if (strstarts(secname, "___ksymtab+"))362 if (strstarts(secname, "___ksymtab+"))
364 return export_plain;363 return export_plain;
365 else if (strstarts(secname, "___ksymtab_unused+"))
366 return export_unused;
367 else if (strstarts(secname, "___ksymtab_gpl+"))364 else if (strstarts(secname, "___ksymtab_gpl+"))
368 return export_gpl;365 return export_gpl;
369 else if (strstarts(secname, "___ksymtab_unused_gpl+"))
370 return export_unused_gpl;
371 else366 else
372 return export_unknown;367 return export_unknown;
373}368}
@@ -376,12 +371,8 @@ static enum export export_from_sec(struct elf_info *elf, unsigned int sec) · 2 unmodified lines
376{371{
377 if (sec == elf->export_sec)372 if (sec == elf->export_sec)
378 return export_plain;373 return export_plain;
379 else if (sec == elf->export_unused_sec)
380 return export_unused;
381 else if (sec == elf->export_gpl_sec)374 else if (sec == elf->export_gpl_sec)
382 return export_gpl;375 return export_gpl;
383 else if (sec == elf->export_unused_gpl_sec)
384 return export_unused_gpl;
385 else376 else
386 return export_unknown;377 return export_unknown;
387}378}
@@ -585,12 +576,8 @@ static int parse_elf(struct elf_info *info, const char *filename) · 197 unmodified lines
585 info->modinfo_len = sechdrs[i].sh_size;576 info->modinfo_len = sechdrs[i].sh_size;
586 } else if (strcmp(secname, "__ksymtab") == 0)577 } else if (strcmp(secname, "__ksymtab") == 0)
587 info->export_sec = i;578 info->export_sec = i;
588 else if (strcmp(secname, "__ksymtab_unused") == 0)
589 info->export_unused_sec = i;
590 else if (strcmp(secname, "__ksymtab_gpl") == 0)579 else if (strcmp(secname, "__ksymtab_gpl") == 0)
591 info->export_gpl_sec = i;580 info->export_gpl_sec = i;
592 else if (strcmp(secname, "__ksymtab_unused_gpl") == 0)
593 info->export_unused_gpl_sec = i;
594 581
595 if (sechdrs[i].sh_type == SHT_SYMTAB) {582 if (sechdrs[i].sh_type == SHT_SYMTAB) {
596 unsigned int sh_link_idx;583 unsigned int sh_link_idx;
@@ -2141,32 +2128,13 @@ static void check_for_gpl_usage(enum export exp, const char *m, const char *s) · 1544 unmodified lines
2141 error("GPL-incompatible module %s.ko uses GPL-only symbol '%s'\n",2128 error("GPL-incompatible module %s.ko uses GPL-only symbol '%s'\n",
2142 m, s);2129 m, s);
2143 break;2130 break;
2144 case export_unused_gpl:
2145 error("GPL-incompatible module %s.ko uses GPL-only symbol marked UNUSED '%s'\n",
2146 m, s);
2147 break;
2148 case export_plain:2131 case export_plain:
2149 case export_unused:
2150 case export_unknown:2132 case export_unknown:
2151 /* ignore */2133 /* ignore */
2152 break;2134 break;
2153 }2135 }
2154}2136}
2155 2137
2156static void check_for_unused(enum export exp, const char *m, const char *s)
2157{
2158 switch (exp) {
2159 case export_unused:
2160 case export_unused_gpl:
2161 warn("module %s.ko uses symbol '%s' marked UNUSED\n",
2162 m, s);
2163 break;
2164 default:
2165 /* ignore */
2166 break;
2167 }
2168}
2169
2170static void check_exports(struct module *mod)2138static void check_exports(struct module *mod)
2171{2139{
2172 struct symbol *s, *exp;2140 struct symbol *s, *exp;
@@ -2197,7 +2165,6 @@ static void check_exports(struct module *mod) · 24 unmodified lines
2197 2165
2198 if (!mod->gpl_compatible)2166 if (!mod->gpl_compatible)
2199 check_for_gpl_usage(exp->export, basename, exp->name);2167 check_for_gpl_usage(exp->export, basename, exp->name);
2200 check_for_unused(exp->export, basename, exp->name);
2201 }2168 }
2202}2169}
2203 2170
scripts/mod/modpost.h+0−2
@@ -139,9 +139,7 @@ struct elf_info { · 138 unmodified lines
139 Elf_Sym *symtab_start;139 Elf_Sym *symtab_start;
140 Elf_Sym *symtab_stop;140 Elf_Sym *symtab_stop;
141 Elf_Section export_sec;141 Elf_Section export_sec;
142 Elf_Section export_unused_sec;
143 Elf_Section export_gpl_sec;142 Elf_Section export_gpl_sec;
144 Elf_Section export_unused_gpl_sec;
145 char *strtab;143 char *strtab;
146 char *modinfo;144 char *modinfo;
147 unsigned int modinfo_len;145 unsigned int modinfo_len;
scripts/module.lds.S+0−4
@@ -11,12 +11,8 @@ SECTIONS { · 10 unmodified lines
11 11
12 __ksymtab 0 : { *(SORT(___ksymtab+*)) }12 __ksymtab 0 : { *(SORT(___ksymtab+*)) }
13 __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) }13 __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) }
14 __ksymtab_unused 0 : { *(SORT(___ksymtab_unused+*)) }
15 __ksymtab_unused_gpl 0 : { *(SORT(___ksymtab_unused_gpl+*)) }
16 __kcrctab 0 : { *(SORT(___kcrctab+*)) }14 __kcrctab 0 : { *(SORT(___kcrctab+*)) }
17 __kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) }15 __kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) }
18 __kcrctab_unused 0 : { *(SORT(___kcrctab_unused+*)) }
19 __kcrctab_unused_gpl 0 : { *(SORT(___kcrctab_unused_gpl+*)) }
20 16
21 .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }17 .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
22 18
tools/include/linux/export.h+0−2
@@ -3,7 +3,5 @@ · 2 unmodified lines
3 3
4#define EXPORT_SYMBOL(sym)4#define EXPORT_SYMBOL(sym)
5#define EXPORT_SYMBOL_GPL(sym)5#define EXPORT_SYMBOL_GPL(sym)
6#define EXPORT_UNUSED_SYMBOL(sym)
7#define EXPORT_UNUSED_SYMBOL_GPL(sym)
8 6
9#endif7#endif