1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef PERF_LINUX_LINKAGE_H_
4 #define PERF_LINUX_LINKAGE_H_
6 /* linkage.h ... for including arch/x86/lib/memcpy_64.S */
8 /* Some toolchains use other characters (e.g. '`') to mark new line in macro */
14 #define __ALIGN .align 4,0x90
15 #define __ALIGN_STR ".align 4,0x90"
18 /* SYM_T_FUNC -- type used by assembler to mark functions */
20 #define SYM_T_FUNC STT_FUNC
23 /* SYM_A_* -- align the symbol? */
24 #define SYM_A_ALIGN ALIGN
26 /* SYM_L_* -- linkage of symbols */
27 #define SYM_L_GLOBAL(name) .globl name
28 #define SYM_L_WEAK(name) .weak name
29 #define SYM_L_LOCAL(name) /* nothing */
33 /* === generic annotations === */
35 /* SYM_ENTRY -- use only if you have to for non-paired symbols */
37 #define SYM_ENTRY(name, linkage, align...) \
38 linkage(name) ASM_NL \
43 /* SYM_START -- use only if you have to */
45 #define SYM_START(name, linkage, align...) \
46 SYM_ENTRY(name, linkage, align)
49 /* SYM_END -- use only if you have to */
51 #define SYM_END(name, sym_type) \
52 .type name sym_type ASM_NL \
57 * SYM_FUNC_START_ALIAS -- use where there are two global names for one
60 #ifndef SYM_FUNC_START_ALIAS
61 #define SYM_FUNC_START_ALIAS(name) \
62 SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
65 /* SYM_FUNC_START -- use for global functions */
66 #ifndef SYM_FUNC_START
68 * The same as SYM_FUNC_START_ALIAS, but we will need to distinguish these two
71 #define SYM_FUNC_START(name) \
72 SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
75 /* SYM_FUNC_START_LOCAL -- use for local functions */
76 #ifndef SYM_FUNC_START_LOCAL
77 /* the same as SYM_FUNC_START_LOCAL_ALIAS, see comment near SYM_FUNC_START */
78 #define SYM_FUNC_START_LOCAL(name) \
79 SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)
82 /* SYM_FUNC_END_ALIAS -- the end of LOCAL_ALIASed or ALIASed function */
83 #ifndef SYM_FUNC_END_ALIAS
84 #define SYM_FUNC_END_ALIAS(name) \
85 SYM_END(name, SYM_T_FUNC)
88 /* SYM_FUNC_START_WEAK -- use for weak functions */
89 #ifndef SYM_FUNC_START_WEAK
90 #define SYM_FUNC_START_WEAK(name) \
91 SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN)
95 * SYM_FUNC_END -- the end of SYM_FUNC_START_LOCAL, SYM_FUNC_START,
96 * SYM_FUNC_START_WEAK, ...
99 /* the same as SYM_FUNC_END_ALIAS, see comment near SYM_FUNC_START */
100 #define SYM_FUNC_END(name) \
101 SYM_END(name, SYM_T_FUNC)
104 #endif /* PERF_LINUX_LINKAGE_H_ */