perf stat aggregation: Add separate node member
[linux-2.6-microblaze.git] / include / asm-generic / export.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __ASM_GENERIC_EXPORT_H
3 #define __ASM_GENERIC_EXPORT_H
4
5 #ifndef KSYM_FUNC
6 #define KSYM_FUNC(x) x
7 #endif
8 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
9 #define KSYM_ALIGN 4
10 #elif defined(CONFIG_64BIT)
11 #define KSYM_ALIGN 8
12 #else
13 #define KSYM_ALIGN 4
14 #endif
15 #ifndef KCRC_ALIGN
16 #define KCRC_ALIGN 4
17 #endif
18
19 .macro __put, val, name
20 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
21         .long   \val - ., \name - ., 0
22 #elif defined(CONFIG_64BIT)
23         .quad   \val, \name, 0
24 #else
25         .long   \val, \name, 0
26 #endif
27 .endm
28
29 /*
30  * note on .section use: we specify progbits since usage of the "M" (SHF_MERGE)
31  * section flag requires it. Use '%progbits' instead of '@progbits' since the
32  * former apparently works on all arches according to the binutils source.
33  */
34
35 .macro ___EXPORT_SYMBOL name,val,sec
36 #ifdef CONFIG_MODULES
37         .section ___ksymtab\sec+\name,"a"
38         .balign KSYM_ALIGN
39 __ksymtab_\name:
40         __put \val, __kstrtab_\name
41         .previous
42         .section __ksymtab_strings,"aMS",%progbits,1
43 __kstrtab_\name:
44         .asciz "\name"
45         .previous
46 #ifdef CONFIG_MODVERSIONS
47         .section ___kcrctab\sec+\name,"a"
48         .balign KCRC_ALIGN
49 #if defined(CONFIG_MODULE_REL_CRCS)
50         .long __crc_\name - .
51 #else
52         .long __crc_\name
53 #endif
54         .weak __crc_\name
55         .previous
56 #endif
57 #endif
58 .endm
59
60 #if defined(CONFIG_TRIM_UNUSED_KSYMS)
61
62 #include <linux/kconfig.h>
63 #include <generated/autoksyms.h>
64
65 .macro __ksym_marker sym
66         .section ".discard.ksym","a"
67 __ksym_marker_\sym:
68          .previous
69 .endm
70
71 #define __EXPORT_SYMBOL(sym, val, sec)                          \
72         __ksym_marker sym;                                      \
73         __cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
74 #define __cond_export_sym(sym, val, sec, conf)                  \
75         ___cond_export_sym(sym, val, sec, conf)
76 #define ___cond_export_sym(sym, val, sec, enabled)              \
77         __cond_export_sym_##enabled(sym, val, sec)
78 #define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
79 #define __cond_export_sym_0(sym, val, sec) /* nothing */
80
81 #else
82 #define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
83 #endif
84
85 #define EXPORT_SYMBOL(name)                                     \
86         __EXPORT_SYMBOL(name, KSYM_FUNC(name),)
87 #define EXPORT_SYMBOL_GPL(name)                                 \
88         __EXPORT_SYMBOL(name, KSYM_FUNC(name), _gpl)
89 #define EXPORT_DATA_SYMBOL(name)                                \
90         __EXPORT_SYMBOL(name, name,)
91 #define EXPORT_DATA_SYMBOL_GPL(name)                            \
92         __EXPORT_SYMBOL(name, name,_gpl)
93
94 #endif