diff options
Diffstat (limited to 'include/linux/export.h')
-rw-r--r-- | include/linux/export.h | 20 |
1 files changed, 14 insertions, 6 deletions
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 */ |