Commit | Line | Data |
---|---|---|
22823ab4 AV |
1 | #ifndef __ASM_GENERIC_EXPORT_H |
2 | #define __ASM_GENERIC_EXPORT_H | |
3 | ||
4 | #ifndef KSYM_FUNC | |
5 | #define KSYM_FUNC(x) x | |
6 | #endif | |
7 | #ifdef CONFIG_64BIT | |
8 | #define __put .quad | |
9 | #ifndef KSYM_ALIGN | |
10 | #define KSYM_ALIGN 8 | |
11 | #endif | |
22823ab4 AV |
12 | #else |
13 | #define __put .long | |
14 | #ifndef KSYM_ALIGN | |
15 | #define KSYM_ALIGN 4 | |
16 | #endif | |
71810db2 | 17 | #endif |
22823ab4 AV |
18 | #ifndef KCRC_ALIGN |
19 | #define KCRC_ALIGN 4 | |
20 | #endif | |
22823ab4 | 21 | |
22823ab4 AV |
22 | /* |
23 | * note on .section use: @progbits vs %progbits nastiness doesn't matter, | |
24 | * since we immediately emit into those sections anyway. | |
25 | */ | |
26 | .macro ___EXPORT_SYMBOL name,val,sec | |
27 | #ifdef CONFIG_MODULES | |
94e58e0a | 28 | .globl __ksymtab_\name |
22823ab4 AV |
29 | .section ___ksymtab\sec+\name,"a" |
30 | .balign KSYM_ALIGN | |
94e58e0a MY |
31 | __ksymtab_\name: |
32 | __put \val, __kstrtab_\name | |
22823ab4 AV |
33 | .previous |
34 | .section __ksymtab_strings,"a" | |
94e58e0a | 35 | __kstrtab_\name: |
22823ab4 | 36 | .asciz "\name" |
22823ab4 AV |
37 | .previous |
38 | #ifdef CONFIG_MODVERSIONS | |
39 | .section ___kcrctab\sec+\name,"a" | |
40 | .balign KCRC_ALIGN | |
94e58e0a | 41 | __kcrctab_\name: |
71810db2 | 42 | #if defined(CONFIG_MODULE_REL_CRCS) |
94e58e0a | 43 | .long __crc_\name - . |
71810db2 | 44 | #else |
94e58e0a | 45 | .long __crc_\name |
71810db2 | 46 | #endif |
94e58e0a | 47 | .weak __crc_\name |
22823ab4 AV |
48 | .previous |
49 | #endif | |
50 | #endif | |
51 | .endm | |
52 | #undef __put | |
53 | ||
54 | #if defined(__KSYM_DEPS__) | |
55 | ||
56 | #define __EXPORT_SYMBOL(sym, val, sec) === __KSYM_##sym === | |
57 | ||
58 | #elif defined(CONFIG_TRIM_UNUSED_KSYMS) | |
59 | ||
60 | #include <linux/kconfig.h> | |
61 | #include <generated/autoksyms.h> | |
62 | ||
63 | #define __EXPORT_SYMBOL(sym, val, sec) \ | |
c0a0aba8 | 64 | __cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym)) |
22823ab4 AV |
65 | #define __cond_export_sym(sym, val, sec, conf) \ |
66 | ___cond_export_sym(sym, val, sec, conf) | |
67 | #define ___cond_export_sym(sym, val, sec, enabled) \ | |
68 | __cond_export_sym_##enabled(sym, val, sec) | |
69 | #define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec | |
70 | #define __cond_export_sym_0(sym, val, sec) /* nothing */ | |
71 | ||
72 | #else | |
73 | #define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec | |
74 | #endif | |
75 | ||
76 | #define EXPORT_SYMBOL(name) \ | |
94e58e0a | 77 | __EXPORT_SYMBOL(name, KSYM_FUNC(name),) |
22823ab4 | 78 | #define EXPORT_SYMBOL_GPL(name) \ |
94e58e0a | 79 | __EXPORT_SYMBOL(name, KSYM_FUNC(name), _gpl) |
22823ab4 | 80 | #define EXPORT_DATA_SYMBOL(name) \ |
94e58e0a | 81 | __EXPORT_SYMBOL(name, name,) |
22823ab4 | 82 | #define EXPORT_DATA_SYMBOL_GPL(name) \ |
94e58e0a | 83 | __EXPORT_SYMBOL(name, name,_gpl) |
22823ab4 AV |
84 | |
85 | #endif |