xref: /openbmc/u-boot/include/linux/linkage.h (revision 4cbd2928)
1 /*
2  * U-boot - linkage.h
3  *
4  * Copyright (c) 2005-2007 Analog Devices Inc.
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #ifndef _LINUX_LINKAGE_H
10 #define _LINUX_LINKAGE_H
11 
12 #include <asm/linkage.h>
13 
14 /* Some toolchains use other characters (e.g. '`') to mark new line in macro */
15 #ifndef ASM_NL
16 #define ASM_NL		 ;
17 #endif
18 
19 #ifdef __cplusplus
20 #define CPP_ASMLINKAGE		extern "C"
21 #else
22 #define CPP_ASMLINKAGE
23 #endif
24 
25 #ifndef asmlinkage
26 #define asmlinkage CPP_ASMLINKAGE
27 #endif
28 
29 #define SYMBOL_NAME_STR(X)	#X
30 #define SYMBOL_NAME(X)		X
31 #ifdef __STDC__
32 #define SYMBOL_NAME_LABEL(X)	X##:
33 #else
34 #define SYMBOL_NAME_LABEL(X)	X:
35 #endif
36 
37 #ifndef __ALIGN
38 #define __ALIGN .align		4
39 #endif
40 
41 #ifndef __ALIGN_STR
42 #define __ALIGN_STR		".align 4"
43 #endif
44 
45 #ifdef __ASSEMBLY__
46 
47 #define ALIGN			__ALIGN
48 #define ALIGN_STR		__ALIGN_STR
49 
50 #define LENTRY(name) \
51 	ALIGN ASM_NL \
52 	SYMBOL_NAME_LABEL(name)
53 
54 #define ENTRY(name) \
55 	.globl SYMBOL_NAME(name) ASM_NL \
56 	LENTRY(name)
57 
58 #define WEAK(name) \
59 	.weak SYMBOL_NAME(name) ASM_NL \
60 	LENTRY(name)
61 
62 #ifndef END
63 #define END(name) \
64 	.size name, .-name
65 #endif
66 
67 #ifndef ENDPROC
68 #define ENDPROC(name) \
69 	.type name STT_FUNC ASM_NL \
70 	END(name)
71 #endif
72 
73 #endif
74 
75 #endif
76