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
177177 CONFIG_DYNAMIC_DEBUG=y
178178 CONFIG_DEBUG_INFO=y
179179 # CONFIG_ENABLE_MUST_CHECK is not set
180−CONFIG_UNUSED_SYMBOLS=y
181180 CONFIG_DEBUG_MEMORY_INIT=y
182181 CONFIG_LOCKUP_DETECTOR=y
183182 CONFIG_SCHED_TRACER=y
arch/arm/configs/mxs_defconfig+0−1
@@ -164,7 +164,6 @@ CONFIG_FONTS=y · 163 unmodified lines
164164 CONFIG_PRINTK_TIME=y
165165 CONFIG_DEBUG_INFO=y
166166 CONFIG_FRAME_WARN=2048
167−CONFIG_UNUSED_SYMBOLS=y
168167 CONFIG_MAGIC_SYSRQ=y
169168 CONFIG_DEBUG_KERNEL=y
170169 CONFIG_SOFTLOCKUP_DETECTOR=y
arch/mips/configs/nlm_xlp_defconfig+0−1
@@ -549,7 +549,6 @@ CONFIG_PRINTK_TIME=y · 548 unmodified lines
549549 CONFIG_DEBUG_INFO=y
550550 # CONFIG_ENABLE_MUST_CHECK is not set
551551 CONFIG_FRAME_WARN=1024
552−CONFIG_UNUSED_SYMBOLS=y
553552 CONFIG_DEBUG_MEMORY_INIT=y
554553 CONFIG_DETECT_HUNG_TASK=y
555554 CONFIG_SCHEDSTATS=y
arch/mips/configs/nlm_xlr_defconfig+0−1
@@ -500,7 +500,6 @@ CONFIG_CRC7=m · 499 unmodified lines
500500 CONFIG_PRINTK_TIME=y
501501 CONFIG_DEBUG_INFO=y
502502 # CONFIG_ENABLE_MUST_CHECK is not set
503−CONFIG_UNUSED_SYMBOLS=y
504503 CONFIG_DEBUG_MEMORY_INIT=y
505504 CONFIG_DETECT_HUNG_TASK=y
506505 CONFIG_SCHEDSTATS=y
arch/parisc/configs/generic-32bit_defconfig+0−1
@@ -22,7 +22,6 @@ CONFIG_PCI_LBA=y · 21 unmodified lines
2222 CONFIG_MODULES=y
2323 CONFIG_MODULE_UNLOAD=y
2424 CONFIG_MODULE_FORCE_UNLOAD=y
25−CONFIG_UNUSED_SYMBOLS=y
2625 # CONFIG_BLK_DEV_BSG is not set
2726 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
2827 CONFIG_BINFMT_MISC=m
arch/parisc/configs/generic-64bit_defconfig+0−1
@@ -31,7 +31,6 @@ CONFIG_MODULE_FORCE_LOAD=y · 30 unmodified lines
3131 CONFIG_MODULE_UNLOAD=y
3232 CONFIG_MODULE_FORCE_UNLOAD=y
3333 CONFIG_MODVERSIONS=y
34−CONFIG_UNUSED_SYMBOLS=y
3534 CONFIG_BLK_DEV_INTEGRITY=y
3635 CONFIG_BINFMT_MISC=m
3736 # CONFIG_COMPACTION is not set
arch/powerpc/configs/ppc6xx_defconfig+0−1
@@ -1072,7 +1072,6 @@ CONFIG_NLS_ISO8859_15=m · 1071 unmodified lines
10721072 CONFIG_NLS_KOI8_R=m
10731073 CONFIG_NLS_KOI8_U=m
10741074 CONFIG_DEBUG_INFO=y
1075−CONFIG_UNUSED_SYMBOLS=y
10761075 CONFIG_HEADERS_INSTALL=y
10771076 CONFIG_MAGIC_SYSRQ=y
10781077 CONFIG_DEBUG_KERNEL=y
arch/s390/configs/debug_defconfig+0−1
@@ -71,7 +71,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y · 70 unmodified lines
7171 CONFIG_MODVERSIONS=y
7272 CONFIG_MODULE_SRCVERSION_ALL=y
7373 CONFIG_MODULE_SIG_SHA256=y
74−CONFIG_UNUSED_SYMBOLS=y
7574 CONFIG_BLK_DEV_INTEGRITY=y
7675 CONFIG_BLK_DEV_THROTTLING=y
7776 CONFIG_BLK_WBT=y
arch/s390/configs/defconfig+0−1
@@ -66,7 +66,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y · 65 unmodified lines
6666 CONFIG_MODVERSIONS=y
6767 CONFIG_MODULE_SRCVERSION_ALL=y
6868 CONFIG_MODULE_SIG_SHA256=y
69−CONFIG_UNUSED_SYMBOLS=y
7069 CONFIG_BLK_DEV_THROTTLING=y
7170 CONFIG_BLK_WBT=y
7271 CONFIG_BLK_CGROUP_IOLATENCY=y
arch/sh/configs/edosk7760_defconfig+0−1
@@ -102,7 +102,6 @@ CONFIG_NLS_UTF8=y · 101 unmodified lines
102102 CONFIG_PRINTK_TIME=y
103103 # CONFIG_ENABLE_MUST_CHECK is not set
104104 CONFIG_MAGIC_SYSRQ=y
105−CONFIG_UNUSED_SYMBOLS=y
106105 CONFIG_DEBUG_KERNEL=y
107106 CONFIG_DEBUG_SHIRQ=y
108107 CONFIG_DETECT_HUNG_TASK=y
arch/sh/configs/sdk7780_defconfig+0−1
@@ -130,7 +130,6 @@ CONFIG_NLS_ISO8859_15=y · 129 unmodified lines
130130 CONFIG_NLS_UTF8=y
131131 # CONFIG_ENABLE_MUST_CHECK is not set
132132 CONFIG_MAGIC_SYSRQ=y
133−CONFIG_UNUSED_SYMBOLS=y
134133 CONFIG_DEBUG_KERNEL=y
135134 CONFIG_DETECT_HUNG_TASK=y
136135 # CONFIG_SCHED_DEBUG is not set
arch/x86/configs/i386_defconfig+0−1
@@ -50,7 +50,6 @@ CONFIG_JUMP_LABEL=y · 49 unmodified lines
5050 CONFIG_MODULES=y
5151 CONFIG_MODULE_UNLOAD=y
5252 CONFIG_MODULE_FORCE_UNLOAD=y
53−# CONFIG_UNUSED_SYMBOLS is not set
5453 CONFIG_BINFMT_MISC=y
5554 CONFIG_NET=y
5655 CONFIG_PACKET=y
arch/x86/configs/x86_64_defconfig+0−1
@@ -48,7 +48,6 @@ CONFIG_JUMP_LABEL=y · 47 unmodified lines
4848 CONFIG_MODULES=y
4949 CONFIG_MODULE_UNLOAD=y
5050 CONFIG_MODULE_FORCE_UNLOAD=y
51−# CONFIG_UNUSED_SYMBOLS is not set
5251 CONFIG_BINFMT_MISC=y
5352 CONFIG_NET=y
5453 CONFIG_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
6161 "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|"
6262 "__(start|end)_pci_.*|"
6363 "__(start|end)_builtin_fw|"
64− "__(start|stop)___ksymtab(|_gpl|_unused|_unused_gpl)|"
65− "__(start|stop)___kcrctab(|_gpl|_unused|_unused_gpl)|"
64+ "__(start|stop)___ksymtab(|_gpl)|"
65+ "__(start|stop)___kcrctab(|_gpl)|"
6666 "__(start|stop)___param|"
6767 "__(start|stop)___modver|"
6868 "__(start|stop)___bug_table|"
include/asm-generic/vmlinux.lds.h+0−28
@@ -481,20 +481,6 @@ · 480 unmodified lines
481481 __stop___ksymtab_gpl = .; \
482482 } \
483483 \
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− \
498484 /* Kernel symbol table: Normal symbols */ \
499485 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
500486 __start___kcrctab = .; \
@@ -509,20 +495,6 @@ · 8 unmodified lines
509495 __stop___kcrctab_gpl = .; \
510496 } \
511497 \
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− \
526498 /* Kernel symbol table: strings */ \
527499 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
528500 *(__ksymtab_strings) \
include/linux/export.h+0−8
@@ -160,14 +160,6 @@ struct kernel_symbol { · 159 unmodified lines
160160 #define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", #ns)
161161 #define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", #ns)
162162
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−
171163 #endif /* !__ASSEMBLY__ */
172164
173165 #endif /* _LINUX_EXPORT_H */
include/linux/module.h+0−12
@@ -392,18 +392,6 @@ struct module { · 391 unmodified lines
392392 const s32 *gpl_crcs;
393393 bool using_gplonly_symbols;
394394
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−
407395 #ifdef CONFIG_MODULE_SIG
408396 /* Signature was verified. */
409397 bool sig_ok;
init/Kconfig+0−17
@@ -2262,25 +2262,8 @@ config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS · 2261 unmodified lines
22622262
22632263 If unsure, say N.
22642264
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−
22812265 config TRIM_UNUSED_KSYMS
22822266 bool "Trim unused exported kernel symbols"
2283− depends on !UNUSED_SYMBOLS
22842267 help
22852268 The kernel and some modules make many symbols available for
22862269 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
410410 extern const struct kernel_symbol __stop___ksymtab_gpl[];
411411 extern const s32 __start___kcrctab[];
412412 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
421413
422414 #ifndef CONFIG_MODVERSIONS
423415 #define symversion(base, idx) NULL
@@ -432,7 +424,6 @@ struct symsearch { · 8 unmodified lines
432424 NOT_GPL_ONLY,
433425 GPL_ONLY,
434426 } license;
435− bool unused;
436427 };
437428
438429 struct find_symbol_arg {
@@ -456,19 +447,6 @@ static bool check_exported_symbol(const struct symsearch *syms, · 17 unmodified lines
456447
457448 if (!fsa->gplok && syms->license == GPL_ONLY)
458449 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−
472450 fsa->owner = owner;
473451 fsa->crc = symversion(syms->crcs, symnum);
474452 fsa->sym = &syms->start[symnum];
@@ -535,18 +513,10 @@ static bool find_symbol(struct find_symbol_arg *fsa) · 60 unmodified lines
535513 {
536514 static const struct symsearch arr[] = {
537515 { __start___ksymtab, __stop___ksymtab, __start___kcrctab,
538− NOT_GPL_ONLY, false },
516+ NOT_GPL_ONLY },
539517 { __start___ksymtab_gpl, __stop___ksymtab_gpl,
540518 __start___kcrctab_gpl,
541− GPL_ONLY, false },
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
519+ GPL_ONLY },
550520 };
551521 struct module *mod;
552522 unsigned int i;
@@ -561,20 +531,10 @@ static bool find_symbol(struct find_symbol_arg *fsa) · 8 unmodified lines
561531 lockdep_is_held(&module_mutex)) {
562532 struct symsearch arr[] = {
563533 { mod->syms, mod->syms + mod->num_syms, mod->crcs,
564− NOT_GPL_ONLY, false },
534+ NOT_GPL_ONLY },
565535 { mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms,
566536 mod->gpl_crcs,
567− GPL_ONLY, false },
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
537+ GPL_ONLY },
578538 };
579539
580540 if (mod->state == MODULE_STATE_UNFORMED)
@@ -2274,10 +2234,6 @@ static int verify_exported_symbols(struct module *mod) · 1693 unmodified lines
22742234 } arr[] = {
22752235 { mod->syms, mod->num_syms },
22762236 { 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
22812237 };
22822238
22832239 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
32903246 &mod->num_gpl_syms);
32913247 mod->gpl_crcs = section_addr(info, "__kcrctab_gpl");
32923248
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
33033249 #ifdef CONFIG_CONSTRUCTORS
33043250 mod->ctors = section_objs(info, ".ctors",
33053251 sizeof(*mod->ctors), &mod->num_ctors);
@@ -3480,13 +3426,8 @@ static int check_module_license_and_versions(struct module *mod) · 174 unmodified lines
34803426 pr_warn("%s: module license taints kernel.\n", mod->name);
34813427
34823428 #ifdef CONFIG_MODVERSIONS
3483− if ((mod->num_syms && !mod->crcs)
3484− || (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− ) {
3429+ if ((mod->num_syms && !mod->crcs) ||
3430+ (mod->num_gpl_syms && !mod->gpl_crcs)) {
34903431 return try_to_force_load(mod,
34913432 "no versions for exported symbols");
34923433 }
scripts/checkpatch.pl+2−4
@@ -4290,8 +4290,7 @@ sub process { · 4289 unmodified lines
42904290 if (defined $realline_next &&
42914291 exists $lines[$realline_next - 1] &&
42924292 !defined $suppress_export{$realline_next} &&
4293− ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/ ||
4294− $lines[$realline_next - 1] =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
4293+ ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
42954294 # Handle definitions which produce identifiers with
42964295 # a prefix:
42974296 # XXX(foo);
@@ -4318,8 +4317,7 @@ sub process { · 20 unmodified lines
43184317 }
43194318 if (!defined $suppress_export{$linenr} &&
43204319 $prevline =~ /^.\s*$/ &&
4321− ($line =~ /EXPORT_SYMBOL.*\((.*)\)/ ||
4322− $line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
4320+ ($line =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
43234321 #print "FOO B <$lines[$linenr - 1]>\n";
43244322 $suppress_export{$linenr} = 2;
43254323 }
scripts/mod/modpost.c+3−36
@@ -43,8 +43,9 @@ static int allow_missing_ns_imports; · 42 unmodified lines
4343 static bool error_occurred;
4444
4545 enum export {
46− export_plain, export_unused, export_gpl,
47− export_unused_gpl, export_unknown
46+ export_plain,
47+ export_gpl,
48+ export_unknown
4849 };
4950
5051 /* In kernel, this size is defined in linux/module.h;
@@ -301,9 +302,7 @@ static const struct { · 250 unmodified lines
301302 enum export export;
302303 } export_list[] = {
303304 { .str = "EXPORT_SYMBOL", .export = export_plain },
304− { .str = "EXPORT_UNUSED_SYMBOL", .export = export_unused },
305305 { .str = "EXPORT_SYMBOL_GPL", .export = export_gpl },
306− { .str = "EXPORT_UNUSED_SYMBOL_GPL", .export = export_unused_gpl },
307306 { .str = "(unknown)", .export = export_unknown },
308307 };
309308
@@ -362,12 +361,8 @@ static enum export export_from_secname(struct elf_info *elf, unsigned int sec) · 52 unmodified lines
362361
363362 if (strstarts(secname, "___ksymtab+"))
364363 return export_plain;
365− else if (strstarts(secname, "___ksymtab_unused+"))
366− return export_unused;
367364 else if (strstarts(secname, "___ksymtab_gpl+"))
368365 return export_gpl;
369− else if (strstarts(secname, "___ksymtab_unused_gpl+"))
370− return export_unused_gpl;
371366 else
372367 return export_unknown;
373368 }
@@ -376,12 +371,8 @@ static enum export export_from_sec(struct elf_info *elf, unsigned int sec) · 2 unmodified lines
376371 {
377372 if (sec == elf->export_sec)
378373 return export_plain;
379− else if (sec == elf->export_unused_sec)
380− return export_unused;
381374 else if (sec == elf->export_gpl_sec)
382375 return export_gpl;
383− else if (sec == elf->export_unused_gpl_sec)
384− return export_unused_gpl;
385376 else
386377 return export_unknown;
387378 }
@@ -585,12 +576,8 @@ static int parse_elf(struct elf_info *info, const char *filename) · 197 unmodified lines
585576 info->modinfo_len = sechdrs[i].sh_size;
586577 } else if (strcmp(secname, "__ksymtab") == 0)
587578 info->export_sec = i;
588− else if (strcmp(secname, "__ksymtab_unused") == 0)
589− info->export_unused_sec = i;
590579 else if (strcmp(secname, "__ksymtab_gpl") == 0)
591580 info->export_gpl_sec = i;
592− else if (strcmp(secname, "__ksymtab_unused_gpl") == 0)
593− info->export_unused_gpl_sec = i;
594581
595582 if (sechdrs[i].sh_type == SHT_SYMTAB) {
596583 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
21412128 error("GPL-incompatible module %s.ko uses GPL-only symbol '%s'\n",
21422129 m, s);
21432130 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;
21482131 case export_plain:
2149− case export_unused:
21502132 case export_unknown:
21512133 /* ignore */
21522134 break;
21532135 }
21542136 }
21552137
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−
21702138 static void check_exports(struct module *mod)
21712139 {
21722140 struct symbol *s, *exp;
@@ -2197,7 +2165,6 @@ static void check_exports(struct module *mod) · 24 unmodified lines
21972165
21982166 if (!mod->gpl_compatible)
21992167 check_for_gpl_usage(exp->export, basename, exp->name);
2200− check_for_unused(exp->export, basename, exp->name);
22012168 }
22022169 }
22032170
scripts/mod/modpost.h+0−2
@@ -139,9 +139,7 @@ struct elf_info { · 138 unmodified lines
139139 Elf_Sym *symtab_start;
140140 Elf_Sym *symtab_stop;
141141 Elf_Section export_sec;
142− Elf_Section export_unused_sec;
143142 Elf_Section export_gpl_sec;
144− Elf_Section export_unused_gpl_sec;
145143 char *strtab;
146144 char *modinfo;
147145 unsigned int modinfo_len;
scripts/module.lds.S+0−4
@@ -11,12 +11,8 @@ SECTIONS { · 10 unmodified lines
1111
1212 __ksymtab 0 : { *(SORT(___ksymtab+*)) }
1313 __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) }
14− __ksymtab_unused 0 : { *(SORT(___ksymtab_unused+*)) }
15− __ksymtab_unused_gpl 0 : { *(SORT(___ksymtab_unused_gpl+*)) }
1614 __kcrctab 0 : { *(SORT(___kcrctab+*)) }
1715 __kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) }
18− __kcrctab_unused 0 : { *(SORT(___kcrctab_unused+*)) }
19− __kcrctab_unused_gpl 0 : { *(SORT(___kcrctab_unused_gpl+*)) }
2016
2117 .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
2218
tools/include/linux/export.h+0−2
@@ -3,7 +3,5 @@ · 2 unmodified lines
33
44 #define EXPORT_SYMBOL(sym)
55 #define EXPORT_SYMBOL_GPL(sym)
6−#define EXPORT_UNUSED_SYMBOL(sym)
7−#define EXPORT_UNUSED_SYMBOL_GPL(sym)
86
97 #endif