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

Showing the changes to kernel (1 of 24 files). Show all

Unified · Split

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 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t