0001
0002 #ifndef _LINUX_LINKAGE_H
0003 #define _LINUX_LINKAGE_H
0004
0005 #include <linux/compiler_types.h>
0006 #include <linux/stringify.h>
0007 #include <linux/export.h>
0008 #include <asm/linkage.h>
0009
0010
0011 #ifndef ASM_NL
0012 #define ASM_NL ;
0013 #endif
0014
0015 #ifdef __cplusplus
0016 #define CPP_ASMLINKAGE extern "C"
0017 #else
0018 #define CPP_ASMLINKAGE
0019 #endif
0020
0021 #ifndef asmlinkage
0022 #define asmlinkage CPP_ASMLINKAGE
0023 #endif
0024
0025 #ifndef cond_syscall
0026 #define cond_syscall(x) asm( \
0027 ".weak " __stringify(x) "\n\t" \
0028 ".set " __stringify(x) "," \
0029 __stringify(sys_ni_syscall))
0030 #endif
0031
0032 #ifndef SYSCALL_ALIAS
0033 #define SYSCALL_ALIAS(alias, name) asm( \
0034 ".globl " __stringify(alias) "\n\t" \
0035 ".set " __stringify(alias) "," \
0036 __stringify(name))
0037 #endif
0038
0039 #define __page_aligned_data __section(".data..page_aligned") __aligned(PAGE_SIZE)
0040 #define __page_aligned_bss __section(".bss..page_aligned") __aligned(PAGE_SIZE)
0041
0042
0043
0044
0045
0046
0047
0048 #define __PAGE_ALIGNED_DATA .section ".data..page_aligned", "aw"
0049 #define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw"
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 #ifndef __ASSEMBLY__
0066 #ifndef asmlinkage_protect
0067 # define asmlinkage_protect(n, ret, args...) do { } while (0)
0068 #endif
0069 #endif
0070
0071 #ifndef __ALIGN
0072 #define __ALIGN .align 4,0x90
0073 #define __ALIGN_STR ".align 4,0x90"
0074 #endif
0075
0076 #ifdef __ASSEMBLY__
0077
0078
0079 #ifndef SYM_T_FUNC
0080 #define SYM_T_FUNC STT_FUNC
0081 #endif
0082
0083
0084 #ifndef SYM_T_OBJECT
0085 #define SYM_T_OBJECT STT_OBJECT
0086 #endif
0087
0088
0089 #ifndef SYM_T_NONE
0090 #define SYM_T_NONE STT_NOTYPE
0091 #endif
0092
0093
0094 #define SYM_A_ALIGN ALIGN
0095 #define SYM_A_NONE
0096
0097
0098 #define SYM_L_GLOBAL(name) .globl name
0099 #define SYM_L_WEAK(name) .weak name
0100 #define SYM_L_LOCAL(name)
0101
0102 #ifndef LINKER_SCRIPT
0103 #define ALIGN __ALIGN
0104 #define ALIGN_STR __ALIGN_STR
0105
0106
0107
0108 #ifndef CONFIG_ARCH_USE_SYM_ANNOTATIONS
0109 #ifndef GLOBAL
0110
0111 #define GLOBAL(name) \
0112 .globl name ASM_NL \
0113 name:
0114 #endif
0115
0116 #ifndef ENTRY
0117
0118 #define ENTRY(name) \
0119 SYM_FUNC_START(name)
0120 #endif
0121 #endif
0122 #endif
0123
0124 #ifndef CONFIG_ARCH_USE_SYM_ANNOTATIONS
0125 #ifndef WEAK
0126
0127 #define WEAK(name) \
0128 SYM_FUNC_START_WEAK(name)
0129 #endif
0130
0131 #ifndef END
0132
0133 #define END(name) \
0134 .size name, .-name
0135 #endif
0136
0137
0138
0139
0140
0141 #ifndef ENDPROC
0142
0143 #define ENDPROC(name) \
0144 SYM_FUNC_END(name)
0145 #endif
0146 #endif
0147
0148
0149
0150
0151 #ifndef SYM_ENTRY
0152 #define SYM_ENTRY(name, linkage, align...) \
0153 linkage(name) ASM_NL \
0154 align ASM_NL \
0155 name:
0156 #endif
0157
0158
0159 #ifndef SYM_START
0160 #define SYM_START(name, linkage, align...) \
0161 SYM_ENTRY(name, linkage, align)
0162 #endif
0163
0164
0165 #ifndef SYM_END
0166 #define SYM_END(name, sym_type) \
0167 .type name sym_type ASM_NL \
0168 .set .L__sym_size_##name, .-name ASM_NL \
0169 .size name, .L__sym_size_##name
0170 #endif
0171
0172
0173 #ifndef SYM_ALIAS
0174 #define SYM_ALIAS(alias, name, linkage) \
0175 linkage(alias) ASM_NL \
0176 .set alias, name ASM_NL
0177 #endif
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198 #ifndef SYM_INNER_LABEL_ALIGN
0199 #define SYM_INNER_LABEL_ALIGN(name, linkage) \
0200 .type name SYM_T_NONE ASM_NL \
0201 SYM_ENTRY(name, linkage, SYM_A_ALIGN)
0202 #endif
0203
0204
0205 #ifndef SYM_INNER_LABEL
0206 #define SYM_INNER_LABEL(name, linkage) \
0207 .type name SYM_T_NONE ASM_NL \
0208 SYM_ENTRY(name, linkage, SYM_A_NONE)
0209 #endif
0210
0211
0212 #ifndef SYM_FUNC_START
0213 #define SYM_FUNC_START(name) \
0214 SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
0215 #endif
0216
0217
0218 #ifndef SYM_FUNC_START_NOALIGN
0219 #define SYM_FUNC_START_NOALIGN(name) \
0220 SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
0221 #endif
0222
0223
0224 #ifndef SYM_FUNC_START_LOCAL
0225 #define SYM_FUNC_START_LOCAL(name) \
0226 SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)
0227 #endif
0228
0229
0230 #ifndef SYM_FUNC_START_LOCAL_NOALIGN
0231 #define SYM_FUNC_START_LOCAL_NOALIGN(name) \
0232 SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
0233 #endif
0234
0235
0236 #ifndef SYM_FUNC_START_WEAK
0237 #define SYM_FUNC_START_WEAK(name) \
0238 SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN)
0239 #endif
0240
0241
0242 #ifndef SYM_FUNC_START_WEAK_NOALIGN
0243 #define SYM_FUNC_START_WEAK_NOALIGN(name) \
0244 SYM_START(name, SYM_L_WEAK, SYM_A_NONE)
0245 #endif
0246
0247
0248
0249
0250
0251 #ifndef SYM_FUNC_END
0252 #define SYM_FUNC_END(name) \
0253 SYM_END(name, SYM_T_FUNC)
0254 #endif
0255
0256
0257
0258
0259 #ifndef SYM_FUNC_ALIAS
0260 #define SYM_FUNC_ALIAS(alias, name) \
0261 SYM_ALIAS(alias, name, SYM_L_GLOBAL)
0262 #endif
0263
0264
0265
0266
0267 #ifndef SYM_FUNC_ALIAS_LOCAL
0268 #define SYM_FUNC_ALIAS_LOCAL(alias, name) \
0269 SYM_ALIAS(alias, name, SYM_L_LOCAL)
0270 #endif
0271
0272
0273
0274
0275 #ifndef SYM_FUNC_ALIAS_WEAK
0276 #define SYM_FUNC_ALIAS_WEAK(alias, name) \
0277 SYM_ALIAS(alias, name, SYM_L_WEAK)
0278 #endif
0279
0280
0281 #ifndef SYM_CODE_START
0282 #define SYM_CODE_START(name) \
0283 SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
0284 #endif
0285
0286
0287 #ifndef SYM_CODE_START_NOALIGN
0288 #define SYM_CODE_START_NOALIGN(name) \
0289 SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
0290 #endif
0291
0292
0293 #ifndef SYM_CODE_START_LOCAL
0294 #define SYM_CODE_START_LOCAL(name) \
0295 SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)
0296 #endif
0297
0298
0299
0300
0301
0302 #ifndef SYM_CODE_START_LOCAL_NOALIGN
0303 #define SYM_CODE_START_LOCAL_NOALIGN(name) \
0304 SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
0305 #endif
0306
0307
0308 #ifndef SYM_CODE_END
0309 #define SYM_CODE_END(name) \
0310 SYM_END(name, SYM_T_NONE)
0311 #endif
0312
0313
0314
0315
0316 #ifndef SYM_DATA_START
0317 #define SYM_DATA_START(name) \
0318 SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
0319 #endif
0320
0321
0322 #ifndef SYM_DATA_START_LOCAL
0323 #define SYM_DATA_START_LOCAL(name) \
0324 SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
0325 #endif
0326
0327
0328 #ifndef SYM_DATA_END
0329 #define SYM_DATA_END(name) \
0330 SYM_END(name, SYM_T_OBJECT)
0331 #endif
0332
0333
0334 #ifndef SYM_DATA_END_LABEL
0335 #define SYM_DATA_END_LABEL(name, linkage, label) \
0336 linkage(label) ASM_NL \
0337 .type label SYM_T_OBJECT ASM_NL \
0338 label: \
0339 SYM_END(name, SYM_T_OBJECT)
0340 #endif
0341
0342
0343 #ifndef SYM_DATA
0344 #define SYM_DATA(name, data...) \
0345 SYM_DATA_START(name) ASM_NL \
0346 data ASM_NL \
0347 SYM_DATA_END(name)
0348 #endif
0349
0350
0351 #ifndef SYM_DATA_LOCAL
0352 #define SYM_DATA_LOCAL(name, data...) \
0353 SYM_DATA_START_LOCAL(name) ASM_NL \
0354 data ASM_NL \
0355 SYM_DATA_END(name)
0356 #endif
0357
0358 #endif
0359
0360 #endif