EXPORT_UNUSED_SYMBOL* is not actually used anywhere. Remove the unused functionality as we generally just remove unused code anyway.
Unified · Split
| @@ -177,7 +177,6 @@ CONFIG_BOOT_PRINTK_DELAY=y · 176 unmodified lines | |||
| 177 | CONFIG_DYNAMIC_DEBUG=y | 177 | CONFIG_DYNAMIC_DEBUG=y |
| 178 | CONFIG_DEBUG_INFO=y | 178 | CONFIG_DEBUG_INFO=y |
| 179 | # CONFIG_ENABLE_MUST_CHECK is not set | 179 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 180 | CONFIG_UNUSED_SYMBOLS=y | ||
| 181 | CONFIG_DEBUG_MEMORY_INIT=y | 180 | CONFIG_DEBUG_MEMORY_INIT=y |
| 182 | CONFIG_LOCKUP_DETECTOR=y | 181 | CONFIG_LOCKUP_DETECTOR=y |
| 183 | CONFIG_SCHED_TRACER=y | 182 | CONFIG_SCHED_TRACER=y |
| @@ -164,7 +164,6 @@ CONFIG_FONTS=y · 163 unmodified lines | |||
| 164 | CONFIG_PRINTK_TIME=y | 164 | CONFIG_PRINTK_TIME=y |
| 165 | CONFIG_DEBUG_INFO=y | 165 | CONFIG_DEBUG_INFO=y |
| 166 | CONFIG_FRAME_WARN=2048 | 166 | CONFIG_FRAME_WARN=2048 |
| 167 | CONFIG_UNUSED_SYMBOLS=y | ||
| 168 | CONFIG_MAGIC_SYSRQ=y | 167 | CONFIG_MAGIC_SYSRQ=y |
| 169 | CONFIG_DEBUG_KERNEL=y | 168 | CONFIG_DEBUG_KERNEL=y |
| 170 | CONFIG_SOFTLOCKUP_DETECTOR=y | 169 | CONFIG_SOFTLOCKUP_DETECTOR=y |
| @@ -549,7 +549,6 @@ CONFIG_PRINTK_TIME=y · 548 unmodified lines | |||
| 549 | CONFIG_DEBUG_INFO=y | 549 | CONFIG_DEBUG_INFO=y |
| 550 | # CONFIG_ENABLE_MUST_CHECK is not set | 550 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 551 | CONFIG_FRAME_WARN=1024 | 551 | CONFIG_FRAME_WARN=1024 |
| 552 | CONFIG_UNUSED_SYMBOLS=y | ||
| 553 | CONFIG_DEBUG_MEMORY_INIT=y | 552 | CONFIG_DEBUG_MEMORY_INIT=y |
| 554 | CONFIG_DETECT_HUNG_TASK=y | 553 | CONFIG_DETECT_HUNG_TASK=y |
| 555 | CONFIG_SCHEDSTATS=y | 554 | CONFIG_SCHEDSTATS=y |
| @@ -500,7 +500,6 @@ CONFIG_CRC7=m · 499 unmodified lines | |||
| 500 | CONFIG_PRINTK_TIME=y | 500 | CONFIG_PRINTK_TIME=y |
| 501 | CONFIG_DEBUG_INFO=y | 501 | CONFIG_DEBUG_INFO=y |
| 502 | # CONFIG_ENABLE_MUST_CHECK is not set | 502 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 503 | CONFIG_UNUSED_SYMBOLS=y | ||
| 504 | CONFIG_DEBUG_MEMORY_INIT=y | 503 | CONFIG_DEBUG_MEMORY_INIT=y |
| 505 | CONFIG_DETECT_HUNG_TASK=y | 504 | CONFIG_DETECT_HUNG_TASK=y |
| 506 | CONFIG_SCHEDSTATS=y | 505 | CONFIG_SCHEDSTATS=y |
| @@ -22,7 +22,6 @@ CONFIG_PCI_LBA=y · 21 unmodified lines | |||
| 22 | CONFIG_MODULES=y | 22 | CONFIG_MODULES=y |
| 23 | CONFIG_MODULE_UNLOAD=y | 23 | CONFIG_MODULE_UNLOAD=y |
| 24 | CONFIG_MODULE_FORCE_UNLOAD=y | 24 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 25 | CONFIG_UNUSED_SYMBOLS=y | ||
| 26 | # CONFIG_BLK_DEV_BSG is not set | 25 | # CONFIG_BLK_DEV_BSG is not set |
| 27 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 26 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 28 | CONFIG_BINFMT_MISC=m | 27 | CONFIG_BINFMT_MISC=m |
| @@ -31,7 +31,6 @@ CONFIG_MODULE_FORCE_LOAD=y · 30 unmodified lines | |||
| 31 | CONFIG_MODULE_UNLOAD=y | 31 | CONFIG_MODULE_UNLOAD=y |
| 32 | CONFIG_MODULE_FORCE_UNLOAD=y | 32 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 33 | CONFIG_MODVERSIONS=y | 33 | CONFIG_MODVERSIONS=y |
| 34 | CONFIG_UNUSED_SYMBOLS=y | ||
| 35 | CONFIG_BLK_DEV_INTEGRITY=y | 34 | CONFIG_BLK_DEV_INTEGRITY=y |
| 36 | CONFIG_BINFMT_MISC=m | 35 | CONFIG_BINFMT_MISC=m |
| 37 | # CONFIG_COMPACTION is not set | 36 | # CONFIG_COMPACTION is not set |
| @@ -1072,7 +1072,6 @@ CONFIG_NLS_ISO8859_15=m · 1071 unmodified lines | |||
| 1072 | CONFIG_NLS_KOI8_R=m | 1072 | CONFIG_NLS_KOI8_R=m |
| 1073 | CONFIG_NLS_KOI8_U=m | 1073 | CONFIG_NLS_KOI8_U=m |
| 1074 | CONFIG_DEBUG_INFO=y | 1074 | CONFIG_DEBUG_INFO=y |
| 1075 | CONFIG_UNUSED_SYMBOLS=y | ||
| 1076 | CONFIG_HEADERS_INSTALL=y | 1075 | CONFIG_HEADERS_INSTALL=y |
| 1077 | CONFIG_MAGIC_SYSRQ=y | 1076 | CONFIG_MAGIC_SYSRQ=y |
| 1078 | CONFIG_DEBUG_KERNEL=y | 1077 | CONFIG_DEBUG_KERNEL=y |
| @@ -71,7 +71,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y · 70 unmodified lines | |||
| 71 | CONFIG_MODVERSIONS=y | 71 | CONFIG_MODVERSIONS=y |
| 72 | CONFIG_MODULE_SRCVERSION_ALL=y | 72 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 73 | CONFIG_MODULE_SIG_SHA256=y | 73 | CONFIG_MODULE_SIG_SHA256=y |
| 74 | CONFIG_UNUSED_SYMBOLS=y | ||
| 75 | CONFIG_BLK_DEV_INTEGRITY=y | 74 | CONFIG_BLK_DEV_INTEGRITY=y |
| 76 | CONFIG_BLK_DEV_THROTTLING=y | 75 | CONFIG_BLK_DEV_THROTTLING=y |
| 77 | CONFIG_BLK_WBT=y | 76 | CONFIG_BLK_WBT=y |
| @@ -66,7 +66,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y · 65 unmodified lines | |||
| 66 | CONFIG_MODVERSIONS=y | 66 | CONFIG_MODVERSIONS=y |
| 67 | CONFIG_MODULE_SRCVERSION_ALL=y | 67 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 68 | CONFIG_MODULE_SIG_SHA256=y | 68 | CONFIG_MODULE_SIG_SHA256=y |
| 69 | CONFIG_UNUSED_SYMBOLS=y | ||
| 70 | CONFIG_BLK_DEV_THROTTLING=y | 69 | CONFIG_BLK_DEV_THROTTLING=y |
| 71 | CONFIG_BLK_WBT=y | 70 | CONFIG_BLK_WBT=y |
| 72 | CONFIG_BLK_CGROUP_IOLATENCY=y | 71 | CONFIG_BLK_CGROUP_IOLATENCY=y |
| @@ -102,7 +102,6 @@ CONFIG_NLS_UTF8=y · 101 unmodified lines | |||
| 102 | CONFIG_PRINTK_TIME=y | 102 | CONFIG_PRINTK_TIME=y |
| 103 | # CONFIG_ENABLE_MUST_CHECK is not set | 103 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 104 | CONFIG_MAGIC_SYSRQ=y | 104 | CONFIG_MAGIC_SYSRQ=y |
| 105 | CONFIG_UNUSED_SYMBOLS=y | ||
| 106 | CONFIG_DEBUG_KERNEL=y | 105 | CONFIG_DEBUG_KERNEL=y |
| 107 | CONFIG_DEBUG_SHIRQ=y | 106 | CONFIG_DEBUG_SHIRQ=y |
| 108 | CONFIG_DETECT_HUNG_TASK=y | 107 | CONFIG_DETECT_HUNG_TASK=y |
| @@ -130,7 +130,6 @@ CONFIG_NLS_ISO8859_15=y · 129 unmodified lines | |||
| 130 | CONFIG_NLS_UTF8=y | 130 | CONFIG_NLS_UTF8=y |
| 131 | # CONFIG_ENABLE_MUST_CHECK is not set | 131 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 132 | CONFIG_MAGIC_SYSRQ=y | 132 | CONFIG_MAGIC_SYSRQ=y |
| 133 | CONFIG_UNUSED_SYMBOLS=y | ||
| 134 | CONFIG_DEBUG_KERNEL=y | 133 | CONFIG_DEBUG_KERNEL=y |
| 135 | CONFIG_DETECT_HUNG_TASK=y | 134 | CONFIG_DETECT_HUNG_TASK=y |
| 136 | # CONFIG_SCHED_DEBUG is not set | 135 | # CONFIG_SCHED_DEBUG is not set |
| @@ -50,7 +50,6 @@ CONFIG_JUMP_LABEL=y · 49 unmodified lines | |||
| 50 | CONFIG_MODULES=y | 50 | CONFIG_MODULES=y |
| 51 | CONFIG_MODULE_UNLOAD=y | 51 | CONFIG_MODULE_UNLOAD=y |
| 52 | CONFIG_MODULE_FORCE_UNLOAD=y | 52 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 53 | # CONFIG_UNUSED_SYMBOLS is not set | ||
| 54 | CONFIG_BINFMT_MISC=y | 53 | CONFIG_BINFMT_MISC=y |
| 55 | CONFIG_NET=y | 54 | CONFIG_NET=y |
| 56 | CONFIG_PACKET=y | 55 | CONFIG_PACKET=y |
| @@ -48,7 +48,6 @@ CONFIG_JUMP_LABEL=y · 47 unmodified lines | |||
| 48 | CONFIG_MODULES=y | 48 | CONFIG_MODULES=y |
| 49 | CONFIG_MODULE_UNLOAD=y | 49 | CONFIG_MODULE_UNLOAD=y |
| 50 | CONFIG_MODULE_FORCE_UNLOAD=y | 50 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 51 | # CONFIG_UNUSED_SYMBOLS is not set | ||
| 52 | CONFIG_BINFMT_MISC=y | 51 | CONFIG_BINFMT_MISC=y |
| 53 | CONFIG_NET=y | 52 | CONFIG_NET=y |
| 54 | CONFIG_PACKET=y | 53 | CONFIG_PACKET=y |
| @@ -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|" |
| @@ -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) \ |
| @@ -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 */ |
| @@ -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_SIG | 395 | #ifdef CONFIG_MODULE_SIG |
| 408 | /* Signature was verified. */ | 396 | /* Signature was verified. */ |
| 409 | bool sig_ok; | 397 | bool sig_ok; |
| @@ -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 | ||
| 2265 | config 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 | |||
| 2281 | config TRIM_UNUSED_KSYMS | 2265 | config TRIM_UNUSED_KSYMS |
| 2282 | bool "Trim unused exported kernel symbols" | 2266 | bool "Trim unused exported kernel symbols" |
| 2283 | depends on !UNUSED_SYMBOLS | ||
| 2284 | help | 2267 | help |
| 2285 | The kernel and some modules make many symbols available for | 2268 | The kernel and some modules make many symbols available for |
| 2286 | other modules to use via EXPORT_SYMBOL() and variants. Depending | 2269 | other modules to use via EXPORT_SYMBOL() and variants. Depending |
| @@ -410,14 +410,6 @@ extern const struct kernel_symbol __start___ksymtab_gpl[]; · 409 unmodified lines | |||
| 410 | extern const struct kernel_symbol __stop___ksymtab_gpl[]; | 410 | extern const struct kernel_symbol __stop___ksymtab_gpl[]; |
| 411 | extern const s32 __start___kcrctab[]; | 411 | extern const s32 __start___kcrctab[]; |
| 412 | extern const s32 __start___kcrctab_gpl[]; | 412 | extern const s32 __start___kcrctab_gpl[]; |
| 413 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 414 | extern const struct kernel_symbol __start___ksymtab_unused[]; | ||
| 415 | extern const struct kernel_symbol __stop___ksymtab_unused[]; | ||
| 416 | extern const struct kernel_symbol __start___ksymtab_unused_gpl[]; | ||
| 417 | extern const struct kernel_symbol __stop___ksymtab_unused_gpl[]; | ||
| 418 | extern const s32 __start___kcrctab_unused[]; | ||
| 419 | extern const s32 __start___kcrctab_unused_gpl[]; | ||
| 420 | #endif | ||
| 421 | 413 | ||
| 422 | #ifndef CONFIG_MODVERSIONS | 414 | #ifndef CONFIG_MODVERSIONS |
| 423 | #define symversion(base, idx) NULL | 415 | #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 | ||
| 438 | struct find_symbol_arg { | 429 | struct 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_CONSTRUCTORS | 3249 | #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_MODVERSIONS | 3428 | #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 | } |
| @@ -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 with | 4294 | # 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 | } |
| @@ -43,8 +43,9 @@ static int allow_missing_ns_imports; · 42 unmodified lines | |||
| 43 | static bool error_occurred; | 43 | static bool error_occurred; |
| 44 | 44 | ||
| 45 | enum export { | 45 | enum export { |
| 46 | export_plain, export_unused, export_gpl, | 46 | export_plain, |
| 47 | export_unused_gpl, export_unknown | 47 | 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 | else | 366 | 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 | else | 376 | 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 | ||
| 2156 | static 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 | |||
| 2170 | static void check_exports(struct module *mod) | 2138 | static 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 | ||
| @@ -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; |
| @@ -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 | ||
| @@ -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 | #endif | 7 | #endif |