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 (1 of 1 file). Show all

Unified · Split

scripts/mod/modpost.c+10−20
@@ -19,9 +19,7 @@ · 18 unmodified lines
19#include <stdbool.h>19#include <stdbool.h>
20#include <errno.h>20#include <errno.h>
21#include "modpost.h"21#include "modpost.h"
22#include "../../include/generated/autoconf.h"
23#include "../../include/linux/license.h"22#include "../../include/linux/license.h"
24#include "../../include/linux/export.h"
25 23
26/* Are we using CONFIG_MODVERSIONS? */24/* Are we using CONFIG_MODVERSIONS? */
27static int modversions = 0;25static int modversions = 0;
@@ -591,7 +589,7 @@ static void parse_elf_finish(struct elf_info *info) · 563 unmodified lines
591static int ignore_undef_symbol(struct elf_info *info, const char *symname)589static int ignore_undef_symbol(struct elf_info *info, const char *symname)
592{590{
593 /* ignore __this_module, it will be resolved shortly */591 /* 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)
595 return 1;593 return 1;
596 /* ignore global offset table */594 /* ignore global offset table */
597 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)595 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
617 return 0;615 return 0;
618}616}
619 617
620#define CRC_PFX VMLINUX_SYMBOL_STR(__crc_)
621#define KSYMTAB_PFX VMLINUX_SYMBOL_STR(__ksymtab_)
622
623static void handle_modversions(struct module *mod, struct elf_info *info,618static void handle_modversions(struct module *mod, struct elf_info *info,
624 Elf_Sym *sym, const char *symname)619 Elf_Sym *sym, const char *symname)
625{620{
@@ -634,7 +629,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 8 unmodified lines
634 export = export_from_sec(info, get_secindex(info, sym));629 export = export_from_sec(info, get_secindex(info, sym));
635 630
636 /* CRC'd symbol */631 /* CRC'd symbol */
637 if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {632 if (strncmp(symname, "__crc_", strlen("__crc_")) == 0) {
638 is_crc = true;633 is_crc = true;
639 crc = (unsigned int) sym->st_value;634 crc = (unsigned int) sym->st_value;
640 if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) {635 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
647 info->sechdrs[sym->st_shndx].sh_addr : 0);642 info->sechdrs[sym->st_shndx].sh_addr : 0);
648 crc = *crcp;643 crc = *crcp;
649 }644 }
650 sym_update_crc(symname + strlen(CRC_PFX), mod, crc,645 sym_update_crc(symname + strlen("__crc_"), mod, crc,
651 export);646 export);
652 }647 }
653 648
@@ -685,15 +680,10 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 31 unmodified lines
685 }680 }
686#endif681#endif
687 682
688#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
689 if (symname[0] != '_')
690 break;
691 else
692 symname++;
693#endif
694 if (is_crc) {683 if (is_crc) {
695 const char *e = is_vmlinux(mod->name) ?"":".ko";684 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);
697 }687 }
698 mod->unres = alloc_symbol(symname,688 mod->unres = alloc_symbol(symname,
699 ELF_ST_BIND(sym->st_info) == STB_WEAK,689 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
701 break;691 break;
702 default:692 default:
703 /* All exported symbols */693 /* All exported symbols */
704 if (strncmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) {694 if (strncmp(symname, "__ksymtab_", strlen("__ksymtab_")) == 0) {
705 sym_add_exported(symname + strlen(KSYMTAB_PFX), mod,695 sym_add_exported(symname + strlen("__ksymtab_"), mod,
706 export);696 export);
707 }697 }
708 if (strcmp(symname, VMLINUX_SYMBOL_STR(init_module)) == 0)698 if (strcmp(symname, "init_module") == 0)
709 mod->has_init = 1;699 mod->has_init = 1;
710 if (strcmp(symname, VMLINUX_SYMBOL_STR(cleanup_module)) == 0)700 if (strcmp(symname, "cleanup_module") == 0)
711 mod->has_cleanup = 1;701 mod->has_cleanup = 1;
712 break;702 break;
713 }703 }
@@ -2230,7 +2220,7 @@ static int add_versions(struct buffer *b, struct module *mod) · 1516 unmodified lines
2230 err = 1;2220 err = 1;
2231 break;2221 break;
2232 }2222 }
2233 buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n",2223 buf_printf(b, "\t{ %#8x, \"%s\" },\n",
2234 s->crc, s->name);2224 s->crc, s->name);
2235 }2225 }
2236 2226