xref: /openbmc/u-boot/include/linux/linkage.h (revision b71eec31)
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 #ifdef __cplusplus
15 #define CPP_ASMLINKAGE		extern "C"
16 #else
17 #define CPP_ASMLINKAGE
18 #endif
19 
20 #ifndef asmlinkage
21 #define asmlinkage CPP_ASMLINKAGE
22 #endif
23 
24 #define SYMBOL_NAME_STR(X)	#X
25 #define SYMBOL_NAME(X)		X
26 #ifdef __STDC__
27 #define SYMBOL_NAME_LABEL(X)	X##:
28 #else
29 #define SYMBOL_NAME_LABEL(X)	X:
30 #endif
31 
32 #ifndef __ALIGN
33 #define __ALIGN .align		4
34 #endif
35 
36 #ifndef __ALIGN_STR
37 #define __ALIGN_STR		".align 4"
38 #endif
39 
40 #ifdef __ASSEMBLY__
41 
42 #define ALIGN			__ALIGN
43 #define ALIGN_STR		__ALIGN_STR
44 
45 #define LENTRY(name) \
46 	ALIGN; \
47 	SYMBOL_NAME_LABEL(name)
48 
49 #define ENTRY(name) \
50 	.globl SYMBOL_NAME(name); \
51 	LENTRY(name)
52 
53 #define WEAK(name) \
54 	.weak SYMBOL_NAME(name); \
55 	LENTRY(name)
56 
57 #ifndef END
58 #define END(name) \
59 	.size name, .-name
60 #endif
61 
62 #ifndef ENDPROC
63 #define ENDPROC(name) \
64 	.type name STT_FUNC; \
65 	END(name)
66 #endif
67 
68 #endif
69 
70 #endif
71