diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | arch/Kconfig | 6 | ||||
-rw-r--r-- | arch/blackfin/Kconfig | 5 | ||||
-rw-r--r-- | arch/h8300/Kconfig | 5 | ||||
-rw-r--r-- | arch/metag/Kconfig | 5 | ||||
-rw-r--r-- | drivers/mtd/chips/gen_probe.c | 8 | ||||
-rw-r--r-- | include/asm-generic/unistd.h | 12 | ||||
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 8 | ||||
-rw-r--r-- | include/linux/export.h | 20 | ||||
-rw-r--r-- | include/linux/kernel.h | 7 | ||||
-rw-r--r-- | include/linux/module.h | 4 | ||||
-rw-r--r-- | kernel/modsign_certificate.S | 13 | ||||
-rw-r--r-- | kernel/module.c | 2 | ||||
-rw-r--r-- | scripts/Makefile.lib | 7 | ||||
-rw-r--r-- | scripts/link-vmlinux.sh | 5 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 36 |
16 files changed, 57 insertions, 88 deletions
@@ -1398,7 +1398,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)) | |||
1398 | # Run depmod only if we have System.map and depmod is executable | 1398 | # Run depmod only if we have System.map and depmod is executable |
1399 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | 1399 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) |
1400 | cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ | 1400 | cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ |
1401 | $(KERNELRELEASE) "$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))" | 1401 | $(KERNELRELEASE) "$(patsubst y,_,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))" |
1402 | 1402 | ||
1403 | # Create temporary dir for module support files | 1403 | # Create temporary dir for module support files |
1404 | # clean it up only when building all modules | 1404 | # clean it up only when building all modules |
diff --git a/arch/Kconfig b/arch/Kconfig index 1455579791ec..7b433a4bcc28 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -384,6 +384,12 @@ config MODULES_USE_ELF_REL | |||
384 | Modules only use ELF REL relocations. Modules with ELF RELA | 384 | Modules only use ELF REL relocations. Modules with ELF RELA |
385 | relocations will give an error. | 385 | relocations will give an error. |
386 | 386 | ||
387 | config HAVE_UNDERSCORE_SYMBOL_PREFIX | ||
388 | bool | ||
389 | help | ||
390 | Some architectures generate an _ in front of C symbols; things like | ||
391 | module loading and assembly files need to know about this. | ||
392 | |||
387 | # | 393 | # |
388 | # ABI hall of shame | 394 | # ABI hall of shame |
389 | # | 395 | # |
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index c3f2e0bc644a..453ebe46b065 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -1,7 +1,3 @@ | |||
1 | config SYMBOL_PREFIX | ||
2 | string | ||
3 | default "_" | ||
4 | |||
5 | config MMU | 1 | config MMU |
6 | def_bool n | 2 | def_bool n |
7 | 3 | ||
@@ -33,6 +29,7 @@ config BLACKFIN | |||
33 | select ARCH_HAVE_CUSTOM_GPIO_H | 29 | select ARCH_HAVE_CUSTOM_GPIO_H |
34 | select ARCH_WANT_OPTIONAL_GPIOLIB | 30 | select ARCH_WANT_OPTIONAL_GPIOLIB |
35 | select HAVE_UID16 | 31 | select HAVE_UID16 |
32 | select HAVE_UNDERSCORE_SYMBOL_PREFIX | ||
36 | select VIRT_TO_BUS | 33 | select VIRT_TO_BUS |
37 | select ARCH_WANT_IPC_PARSE_VERSION | 34 | select ARCH_WANT_IPC_PARSE_VERSION |
38 | select HAVE_GENERIC_HARDIRQS | 35 | select HAVE_GENERIC_HARDIRQS |
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 79250de1b12a..303e4f9a79d1 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig | |||
@@ -12,10 +12,7 @@ config H8300 | |||
12 | select MODULES_USE_ELF_RELA | 12 | select MODULES_USE_ELF_RELA |
13 | select OLD_SIGSUSPEND3 | 13 | select OLD_SIGSUSPEND3 |
14 | select OLD_SIGACTION | 14 | select OLD_SIGACTION |
15 | 15 | select HAVE_UNDERSCORE_SYMBOL_PREFIX | |
16 | config SYMBOL_PREFIX | ||
17 | string | ||
18 | default "_" | ||
19 | 16 | ||
20 | config MMU | 17 | config MMU |
21 | bool | 18 | bool |
diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig index afc8973d1488..2099617e3ec0 100644 --- a/arch/metag/Kconfig +++ b/arch/metag/Kconfig | |||
@@ -1,7 +1,3 @@ | |||
1 | config SYMBOL_PREFIX | ||
2 | string | ||
3 | default "_" | ||
4 | |||
5 | config METAG | 1 | config METAG |
6 | def_bool y | 2 | def_bool y |
7 | select EMBEDDED | 3 | select EMBEDDED |
@@ -27,6 +23,7 @@ config METAG | |||
27 | select HAVE_MOD_ARCH_SPECIFIC | 23 | select HAVE_MOD_ARCH_SPECIFIC |
28 | select HAVE_PERF_EVENTS | 24 | select HAVE_PERF_EVENTS |
29 | select HAVE_SYSCALL_TRACEPOINTS | 25 | select HAVE_SYSCALL_TRACEPOINTS |
26 | select HAVE_UNDERSCORE_SYMBOL_PREFIX | ||
30 | select IRQ_DOMAIN | 27 | select IRQ_DOMAIN |
31 | select MODULES_USE_ELF_RELA | 28 | select MODULES_USE_ELF_RELA |
32 | select OF | 29 | select OF |
diff --git a/drivers/mtd/chips/gen_probe.c b/drivers/mtd/chips/gen_probe.c index 3b9a2843c5f8..74dbb6bcf488 100644 --- a/drivers/mtd/chips/gen_probe.c +++ b/drivers/mtd/chips/gen_probe.c | |||
@@ -204,14 +204,16 @@ static inline struct mtd_info *cfi_cmdset_unknown(struct map_info *map, | |||
204 | struct cfi_private *cfi = map->fldrv_priv; | 204 | struct cfi_private *cfi = map->fldrv_priv; |
205 | __u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID; | 205 | __u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID; |
206 | #ifdef CONFIG_MODULES | 206 | #ifdef CONFIG_MODULES |
207 | char probename[16+sizeof(MODULE_SYMBOL_PREFIX)]; | 207 | char probename[sizeof(VMLINUX_SYMBOL_STR(cfi_cmdset_%4.4X))]; |
208 | cfi_cmdset_fn_t *probe_function; | 208 | cfi_cmdset_fn_t *probe_function; |
209 | 209 | ||
210 | sprintf(probename, MODULE_SYMBOL_PREFIX "cfi_cmdset_%4.4X", type); | 210 | sprintf(probename, VMLINUX_SYMBOL_STR(cfi_cmdset_%4.4X), type); |
211 | 211 | ||
212 | probe_function = __symbol_get(probename); | 212 | probe_function = __symbol_get(probename); |
213 | if (!probe_function) { | 213 | if (!probe_function) { |
214 | request_module(probename + sizeof(MODULE_SYMBOL_PREFIX) - 1); | 214 | char modname[sizeof("cfi_cmdset_%4.4X")]; |
215 | sprintf(modname, "cfi_cmdset_%4.4X", type); | ||
216 | request_module(modname); | ||
215 | probe_function = __symbol_get(probename); | 217 | probe_function = __symbol_get(probename); |
216 | } | 218 | } |
217 | 219 | ||
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index 4077b5d9ff81..15c0598e1109 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <uapi/asm-generic/unistd.h> | 1 | #include <uapi/asm-generic/unistd.h> |
2 | #include <linux/export.h> | ||
2 | 3 | ||
3 | /* | 4 | /* |
4 | * These are required system calls, we should | 5 | * These are required system calls, we should |
@@ -17,12 +18,7 @@ | |||
17 | * but it doesn't work on all toolchains, so we just do it by hand | 18 | * but it doesn't work on all toolchains, so we just do it by hand |
18 | */ | 19 | */ |
19 | #ifndef cond_syscall | 20 | #ifndef cond_syscall |
20 | #ifdef CONFIG_SYMBOL_PREFIX | 21 | #define cond_syscall(x) asm(".weak\t" VMLINUX_SYMBOL_STR(x) "\n\t" \ |
21 | #define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | 22 | ".set\t" VMLINUX_SYMBOL_STR(x) "," \ |
22 | #else | 23 | VMLINUX_SYMBOL_STR(sys_ni_syscall)) |
23 | #define __SYMBOL_PREFIX | ||
24 | #endif | ||
25 | #define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \ | ||
26 | ".set\t" __SYMBOL_PREFIX #x "," \ | ||
27 | __SYMBOL_PREFIX "sys_ni_syscall") | ||
28 | #endif | 24 | #endif |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index afa12c7a025c..eb58d2d7d971 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -52,13 +52,7 @@ | |||
52 | #define LOAD_OFFSET 0 | 52 | #define LOAD_OFFSET 0 |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #ifndef SYMBOL_PREFIX | 55 | #include <linux/export.h> |
56 | #define VMLINUX_SYMBOL(sym) sym | ||
57 | #else | ||
58 | #define PASTE2(x,y) x##y | ||
59 | #define PASTE(x,y) PASTE2(x,y) | ||
60 | #define VMLINUX_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym) | ||
61 | #endif | ||
62 | 56 | ||
63 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ | 57 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ |
64 | #define ALIGN_FUNCTION() . = ALIGN(8) | 58 | #define ALIGN_FUNCTION() . = ALIGN(8) |
diff --git a/include/linux/export.h b/include/linux/export.h index 696c0f48afc7..412cd509effe 100644 --- a/include/linux/export.h +++ b/include/linux/export.h | |||
@@ -5,17 +5,24 @@ | |||
5 | * to reduce the amount of pointless cruft we feed to gcc when only | 5 | * to reduce the amount of pointless cruft we feed to gcc when only |
6 | * exporting a simple symbol or two. | 6 | * exporting a simple symbol or two. |
7 | * | 7 | * |
8 | * If you feel the need to add #include <linux/foo.h> to this file | 8 | * Try not to add #includes here. It slows compilation and makes kernel |
9 | * then you are doing something wrong and should go away silently. | 9 | * hackers place grumpy comments in header files. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* Some toolchains use a `_' prefix for all user symbols. */ | 12 | /* Some toolchains use a `_' prefix for all user symbols. */ |
13 | #ifdef CONFIG_SYMBOL_PREFIX | 13 | #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX |
14 | #define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | 14 | #define __VMLINUX_SYMBOL(x) _##x |
15 | #define __VMLINUX_SYMBOL_STR(x) "_" #x | ||
15 | #else | 16 | #else |
16 | #define MODULE_SYMBOL_PREFIX "" | 17 | #define __VMLINUX_SYMBOL(x) x |
18 | #define __VMLINUX_SYMBOL_STR(x) #x | ||
17 | #endif | 19 | #endif |
18 | 20 | ||
21 | /* Indirect, so macros are expanded before pasting. */ | ||
22 | #define VMLINUX_SYMBOL(x) __VMLINUX_SYMBOL(x) | ||
23 | #define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x) | ||
24 | |||
25 | #ifndef __ASSEMBLY__ | ||
19 | struct kernel_symbol | 26 | struct kernel_symbol |
20 | { | 27 | { |
21 | unsigned long value; | 28 | unsigned long value; |
@@ -51,7 +58,7 @@ extern struct module __this_module; | |||
51 | __CRC_SYMBOL(sym, sec) \ | 58 | __CRC_SYMBOL(sym, sec) \ |
52 | static const char __kstrtab_##sym[] \ | 59 | static const char __kstrtab_##sym[] \ |
53 | __attribute__((section("__ksymtab_strings"), aligned(1))) \ | 60 | __attribute__((section("__ksymtab_strings"), aligned(1))) \ |
54 | = MODULE_SYMBOL_PREFIX #sym; \ | 61 | = VMLINUX_SYMBOL_STR(sym); \ |
55 | static const struct kernel_symbol __ksymtab_##sym \ | 62 | static const struct kernel_symbol __ksymtab_##sym \ |
56 | __used \ | 63 | __used \ |
57 | __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ | 64 | __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ |
@@ -85,5 +92,6 @@ extern struct module __this_module; | |||
85 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) | 92 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) |
86 | 93 | ||
87 | #endif /* CONFIG_MODULES */ | 94 | #endif /* CONFIG_MODULES */ |
95 | #endif /* !__ASSEMBLY__ */ | ||
88 | 96 | ||
89 | #endif /* _LINUX_EXPORT_H */ | 97 | #endif /* _LINUX_EXPORT_H */ |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 80d36874689b..e13e992eae8a 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -723,13 +723,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } | |||
723 | /* Trap pasters of __FUNCTION__ at compile-time */ | 723 | /* Trap pasters of __FUNCTION__ at compile-time */ |
724 | #define __FUNCTION__ (__func__) | 724 | #define __FUNCTION__ (__func__) |
725 | 725 | ||
726 | /* This helps us to avoid #ifdef CONFIG_SYMBOL_PREFIX */ | ||
727 | #ifdef CONFIG_SYMBOL_PREFIX | ||
728 | #define SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | ||
729 | #else | ||
730 | #define SYMBOL_PREFIX "" | ||
731 | #endif | ||
732 | |||
733 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ | 726 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ |
734 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 727 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
735 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD | 728 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD |
diff --git a/include/linux/module.h b/include/linux/module.h index ead1b5719a12..46f1ea01e6f6 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -190,7 +190,7 @@ extern int modules_disabled; /* for sysctl */ | |||
190 | /* Get/put a kernel symbol (calls must be symmetric) */ | 190 | /* Get/put a kernel symbol (calls must be symmetric) */ |
191 | void *__symbol_get(const char *symbol); | 191 | void *__symbol_get(const char *symbol); |
192 | void *__symbol_get_gpl(const char *symbol); | 192 | void *__symbol_get_gpl(const char *symbol); |
193 | #define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x))) | 193 | #define symbol_get(x) ((typeof(&x))(__symbol_get(VMLINUX_SYMBOL_STR(x)))) |
194 | 194 | ||
195 | /* modules using other modules: kdb wants to see this. */ | 195 | /* modules using other modules: kdb wants to see this. */ |
196 | struct module_use { | 196 | struct module_use { |
@@ -453,7 +453,7 @@ extern void __module_put_and_exit(struct module *mod, long code) | |||
453 | #ifdef CONFIG_MODULE_UNLOAD | 453 | #ifdef CONFIG_MODULE_UNLOAD |
454 | unsigned long module_refcount(struct module *mod); | 454 | unsigned long module_refcount(struct module *mod); |
455 | void __symbol_put(const char *symbol); | 455 | void __symbol_put(const char *symbol); |
456 | #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) | 456 | #define symbol_put(x) __symbol_put(VMLINUX_SYMBOL_STR(x)) |
457 | void symbol_put_addr(void *addr); | 457 | void symbol_put_addr(void *addr); |
458 | 458 | ||
459 | /* Sometimes we know we already have a refcount, and it's easier not | 459 | /* Sometimes we know we already have a refcount, and it's easier not |
diff --git a/kernel/modsign_certificate.S b/kernel/modsign_certificate.S index 246b4c6e6135..4a9a86d12c8b 100644 --- a/kernel/modsign_certificate.S +++ b/kernel/modsign_certificate.S | |||
@@ -1,15 +1,8 @@ | |||
1 | /* SYMBOL_PREFIX defined on commandline from CONFIG_SYMBOL_PREFIX */ | 1 | #include <linux/export.h> |
2 | #ifndef SYMBOL_PREFIX | ||
3 | #define ASM_SYMBOL(sym) sym | ||
4 | #else | ||
5 | #define PASTE2(x,y) x##y | ||
6 | #define PASTE(x,y) PASTE2(x,y) | ||
7 | #define ASM_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym) | ||
8 | #endif | ||
9 | 2 | ||
10 | #define GLOBAL(name) \ | 3 | #define GLOBAL(name) \ |
11 | .globl ASM_SYMBOL(name); \ | 4 | .globl VMLINUX_SYMBOL(name); \ |
12 | ASM_SYMBOL(name): | 5 | VMLINUX_SYMBOL(name): |
13 | 6 | ||
14 | .section ".init.data","aw" | 7 | .section ".init.data","aw" |
15 | 8 | ||
diff --git a/kernel/module.c b/kernel/module.c index 0925c9a71975..cfd4a3f68d7d 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1209,7 +1209,7 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, | |||
1209 | 1209 | ||
1210 | /* Since this should be found in kernel (which can't be removed), | 1210 | /* Since this should be found in kernel (which can't be removed), |
1211 | * no locking is necessary. */ | 1211 | * no locking is necessary. */ |
1212 | if (!find_symbol(MODULE_SYMBOL_PREFIX "module_layout", NULL, | 1212 | if (!find_symbol(VMLINUX_SYMBOL_STR(module_layout), NULL, |
1213 | &crc, true, false)) | 1213 | &crc, true, false)) |
1214 | BUG(); | 1214 | BUG(); |
1215 | return check_version(sechdrs, versindex, "module_layout", mod, crc, | 1215 | return check_version(sechdrs, versindex, "module_layout", mod, crc, |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 07125e697d7a..a373a1f66023 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -119,13 +119,6 @@ _c_flags += $(if $(patsubst n%,, \ | |||
119 | $(CFLAGS_GCOV)) | 119 | $(CFLAGS_GCOV)) |
120 | endif | 120 | endif |
121 | 121 | ||
122 | ifdef CONFIG_SYMBOL_PREFIX | ||
123 | _sym_flags = -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)) | ||
124 | _cpp_flags += $(_sym_flags) | ||
125 | _a_flags += $(_sym_flags) | ||
126 | endif | ||
127 | |||
128 | |||
129 | # If building the kernel in a separate objtree expand all occurrences | 122 | # If building the kernel in a separate objtree expand all occurrences |
130 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). | 123 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). |
131 | 124 | ||
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 3d569d6022c2..014994936b1c 100644 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
@@ -74,9 +74,8 @@ kallsyms() | |||
74 | info KSYM ${2} | 74 | info KSYM ${2} |
75 | local kallsymopt; | 75 | local kallsymopt; |
76 | 76 | ||
77 | if [ -n "${CONFIG_SYMBOL_PREFIX}" ]; then | 77 | if [ -n "${CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX}" ]; then |
78 | kallsymopt="${kallsymopt} \ | 78 | kallsymopt="${kallsymopt} --symbol-prefix=_" |
79 | --symbol-prefix=${CONFIG_SYMBOL_PREFIX}" | ||
80 | fi | 79 | fi |
81 | 80 | ||
82 | if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then | 81 | if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 78b30c1548e9..282decfa29ae 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -18,14 +18,7 @@ | |||
18 | #include "modpost.h" | 18 | #include "modpost.h" |
19 | #include "../../include/generated/autoconf.h" | 19 | #include "../../include/generated/autoconf.h" |
20 | #include "../../include/linux/license.h" | 20 | #include "../../include/linux/license.h" |
21 | 21 | #include "../../include/linux/export.h" | |
22 | /* Some toolchains use a `_' prefix for all user symbols. */ | ||
23 | #ifdef CONFIG_SYMBOL_PREFIX | ||
24 | #define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | ||
25 | #else | ||
26 | #define MODULE_SYMBOL_PREFIX "" | ||
27 | #endif | ||
28 | |||
29 | 22 | ||
30 | /* Are we using CONFIG_MODVERSIONS? */ | 23 | /* Are we using CONFIG_MODVERSIONS? */ |
31 | int modversions = 0; | 24 | int modversions = 0; |
@@ -562,7 +555,7 @@ static void parse_elf_finish(struct elf_info *info) | |||
562 | static int ignore_undef_symbol(struct elf_info *info, const char *symname) | 555 | static int ignore_undef_symbol(struct elf_info *info, const char *symname) |
563 | { | 556 | { |
564 | /* ignore __this_module, it will be resolved shortly */ | 557 | /* ignore __this_module, it will be resolved shortly */ |
565 | if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0) | 558 | if (strcmp(symname, VMLINUX_SYMBOL_STR(__this_module)) == 0) |
566 | return 1; | 559 | return 1; |
567 | /* ignore global offset table */ | 560 | /* ignore global offset table */ |
568 | if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0) | 561 | if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0) |
@@ -583,8 +576,8 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname) | |||
583 | return 0; | 576 | return 0; |
584 | } | 577 | } |
585 | 578 | ||
586 | #define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_" | 579 | #define CRC_PFX VMLINUX_SYMBOL_STR(__crc_) |
587 | #define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_" | 580 | #define KSYMTAB_PFX VMLINUX_SYMBOL_STR(__ksymtab_) |
588 | 581 | ||
589 | static void handle_modversions(struct module *mod, struct elf_info *info, | 582 | static void handle_modversions(struct module *mod, struct elf_info *info, |
590 | Elf_Sym *sym, const char *symname) | 583 | Elf_Sym *sym, const char *symname) |
@@ -637,14 +630,15 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
637 | } | 630 | } |
638 | #endif | 631 | #endif |
639 | 632 | ||
640 | if (memcmp(symname, MODULE_SYMBOL_PREFIX, | 633 | #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX |
641 | strlen(MODULE_SYMBOL_PREFIX)) == 0) { | 634 | if (symname[0] != '_') |
642 | mod->unres = | 635 | break; |
643 | alloc_symbol(symname + | 636 | else |
644 | strlen(MODULE_SYMBOL_PREFIX), | 637 | symname++; |
645 | ELF_ST_BIND(sym->st_info) == STB_WEAK, | 638 | #endif |
646 | mod->unres); | 639 | mod->unres = alloc_symbol(symname, |
647 | } | 640 | ELF_ST_BIND(sym->st_info) == STB_WEAK, |
641 | mod->unres); | ||
648 | break; | 642 | break; |
649 | default: | 643 | default: |
650 | /* All exported symbols */ | 644 | /* All exported symbols */ |
@@ -652,9 +646,9 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
652 | sym_add_exported(symname + strlen(KSYMTAB_PFX), mod, | 646 | sym_add_exported(symname + strlen(KSYMTAB_PFX), mod, |
653 | export); | 647 | export); |
654 | } | 648 | } |
655 | if (strcmp(symname, MODULE_SYMBOL_PREFIX "init_module") == 0) | 649 | if (strcmp(symname, VMLINUX_SYMBOL_STR(init_module)) == 0) |
656 | mod->has_init = 1; | 650 | mod->has_init = 1; |
657 | if (strcmp(symname, MODULE_SYMBOL_PREFIX "cleanup_module") == 0) | 651 | if (strcmp(symname, VMLINUX_SYMBOL_STR(cleanup_module)) == 0) |
658 | mod->has_cleanup = 1; | 652 | mod->has_cleanup = 1; |
659 | break; | 653 | break; |
660 | } | 654 | } |