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 scripts (4 of 24 files). Show all

Unified · Split

4 files
  1. scripts/checkpatch.pl +2 −4
  2. scripts/mod/modpost.c +3 −36
  3. scripts/mod/modpost.h +0 −2
  4. scripts/module.lds.S +0 −4
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