1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 #ifndef PERF_LINUX_LINKAGE_H_ 4 #define PERF_LINUX_LINKAGE_H_ 5 6 /* linkage.h ... for including arch/x86/lib/memcpy_64.S */ 7 8 /* Some toolchains use other characters (e.g. '`') to mark new line in macro */ 9 #ifndef ASM_NL 10 #define ASM_NL ; 11 #endif 12 13 #ifndef __ALIGN 14 #define __ALIGN .align 4,0x90 15 #define __ALIGN_STR ".align 4,0x90" 16 #endif 17 18 /* SYM_T_FUNC -- type used by assembler to mark functions */ 19 #ifndef SYM_T_FUNC 20 #define SYM_T_FUNC STT_FUNC 21 #endif 22 23 /* SYM_A_* -- align the symbol? */ 24 #define SYM_A_ALIGN ALIGN 25 26 /* SYM_L_* -- linkage of symbols */ 27 #define SYM_L_GLOBAL(name) .globl name 28 #define SYM_L_LOCAL(name) /* nothing */ 29 30 #define ALIGN __ALIGN 31 32 /* === generic annotations === */ 33 34 /* SYM_ENTRY -- use only if you have to for non-paired symbols */ 35 #ifndef SYM_ENTRY 36 #define SYM_ENTRY(name, linkage, align...) \ 37 linkage(name) ASM_NL \ 38 align ASM_NL \ 39 name: 40 #endif 41 42 /* SYM_START -- use only if you have to */ 43 #ifndef SYM_START 44 #define SYM_START(name, linkage, align...) \ 45 SYM_ENTRY(name, linkage, align) 46 #endif 47 48 /* SYM_END -- use only if you have to */ 49 #ifndef SYM_END 50 #define SYM_END(name, sym_type) \ 51 .type name sym_type ASM_NL \ 52 .size name, .-name 53 #endif 54 55 /* 56 * SYM_FUNC_START_ALIAS -- use where there are two global names for one 57 * function 58 */ 59 #ifndef SYM_FUNC_START_ALIAS 60 #define SYM_FUNC_START_ALIAS(name) \ 61 SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) 62 #endif 63 64 /* SYM_FUNC_START -- use for global functions */ 65 #ifndef SYM_FUNC_START 66 /* 67 * The same as SYM_FUNC_START_ALIAS, but we will need to distinguish these two 68 * later. 69 */ 70 #define SYM_FUNC_START(name) \ 71 SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) 72 #endif 73 74 /* SYM_FUNC_START_LOCAL -- use for local functions */ 75 #ifndef SYM_FUNC_START_LOCAL 76 /* the same as SYM_FUNC_START_LOCAL_ALIAS, see comment near SYM_FUNC_START */ 77 #define SYM_FUNC_START_LOCAL(name) \ 78 SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) 79 #endif 80 81 /* SYM_FUNC_END_ALIAS -- the end of LOCAL_ALIASed or ALIASed function */ 82 #ifndef SYM_FUNC_END_ALIAS 83 #define SYM_FUNC_END_ALIAS(name) \ 84 SYM_END(name, SYM_T_FUNC) 85 #endif 86 87 /* 88 * SYM_FUNC_END -- the end of SYM_FUNC_START_LOCAL, SYM_FUNC_START, 89 * SYM_FUNC_START_WEAK, ... 90 */ 91 #ifndef SYM_FUNC_END 92 /* the same as SYM_FUNC_END_ALIAS, see comment near SYM_FUNC_START */ 93 #define SYM_FUNC_END(name) \ 94 SYM_END(name, SYM_T_FUNC) 95 #endif 96 97 #endif /* PERF_LINUX_LINKAGE_H_ */ 98