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