History

modpost: remove symbol prefix support

CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX was selected by BLACKFIN, METAG. They were removed by commit 4ba66a976072 ("arch: remove blackfin port"), commit bb6fb6dfcc17 ("metag: Remove arch/metag/"), respectively. No more architecture enables CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX, hence VMLINUX_SYMBOL_STR(foo) can be simplify replaced with "foo".

Masahiro Yamada committed 8 years ago

Commit b2c5cdc1 parent d5940c61 file · +10 −20Browse files

Showing the changes to scripts/mod (1 of 1 file). Show all

Unified · Split

scripts/mod/modpost.c+10−20
@@ -19,9 +19,7 @@ · 18 unmodified lines
1919 #include <stdbool.h>
2020 #include <errno.h>
2121 #include "modpost.h"
22−#include "../../include/generated/autoconf.h"
2322 #include "../../include/linux/license.h"
24−#include "../../include/linux/export.h"
2523
2624 /* Are we using CONFIG_MODVERSIONS? */
2725 static int modversions = 0;
@@ -591,7 +589,7 @@ static void parse_elf_finish(struct elf_info *info) · 563 unmodified lines
591589 static int ignore_undef_symbol(struct elf_info *info, const char *symname)
592590 {
593591 /* ignore __this_module, it will be resolved shortly */
594− if (strcmp(symname, VMLINUX_SYMBOL_STR(__this_module)) == 0)
592+ if (strcmp(symname, "__this_module") == 0)
595593 return 1;
596594 /* ignore global offset table */
597595 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
@@ -617,9 +615,6 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname) · 19 unmodified lines
617615 return 0;
618616 }
619617
620−#define CRC_PFX VMLINUX_SYMBOL_STR(__crc_)
621−#define KSYMTAB_PFX VMLINUX_SYMBOL_STR(__ksymtab_)
622−
623618 static void handle_modversions(struct module *mod, struct elf_info *info,
624619 Elf_Sym *sym, const char *symname)
625620 {
@@ -634,7 +629,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 8 unmodified lines
634629 export = export_from_sec(info, get_secindex(info, sym));
635630
636631 /* CRC'd symbol */
637− if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
632+ if (strncmp(symname, "__crc_", strlen("__crc_")) == 0) {
638633 is_crc = true;
639634 crc = (unsigned int) sym->st_value;
640635 if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) {
@@ -647,7 +642,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 6 unmodified lines
647642 info->sechdrs[sym->st_shndx].sh_addr : 0);
648643 crc = *crcp;
649644 }
650− sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
645+ sym_update_crc(symname + strlen("__crc_"), mod, crc,
651646 export);
652647 }
653648
@@ -685,15 +680,10 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 31 unmodified lines
685680 }
686681 #endif
687682
688−#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
689− if (symname[0] != '_')
690− break;
691− else
692− symname++;
693−#endif
694683 if (is_crc) {
695684 const char *e = is_vmlinux(mod->name) ?"":".ko";
696− warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n", symname + strlen(CRC_PFX), mod->name, e);
685+ warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n",
686+ symname + strlen("__crc_"), mod->name, e);
697687 }
698688 mod->unres = alloc_symbol(symname,
699689 ELF_ST_BIND(sym->st_info) == STB_WEAK,
@@ -701,13 +691,13 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 1 unmodified line
701691 break;
702692 default:
703693 /* All exported symbols */
704− if (strncmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) {
705− sym_add_exported(symname + strlen(KSYMTAB_PFX), mod,
694+ if (strncmp(symname, "__ksymtab_", strlen("__ksymtab_")) == 0) {
695+ sym_add_exported(symname + strlen("__ksymtab_"), mod,
706696 export);
707697 }
708− if (strcmp(symname, VMLINUX_SYMBOL_STR(init_module)) == 0)
698+ if (strcmp(symname, "init_module") == 0)
709699 mod->has_init = 1;
710− if (strcmp(symname, VMLINUX_SYMBOL_STR(cleanup_module)) == 0)
700+ if (strcmp(symname, "cleanup_module") == 0)
711701 mod->has_cleanup = 1;
712702 break;
713703 }
@@ -2230,7 +2220,7 @@ static int add_versions(struct buffer *b, struct module *mod) · 1516 unmodified lines
22302220 err = 1;
22312221 break;
22322222 }
2233− buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n",
2223+ buf_printf(b, "\t{ %#8x, \"%s\" },\n",
22342224 s->crc, s->name);
22352225 }
22362226