Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 1 | /* |
Bin Meng | 7557405 | 2016-02-05 19:30:11 -0800 | [diff] [blame] | 2 | * U-Boot - linkage.h |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 3 | * |
4 | * Copyright (c) 2005-2007 Analog Devices Inc. | ||||
5 | * | ||||
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 7 | */ |
8 | |||||
9 | #ifndef _LINUX_LINKAGE_H | ||||
10 | #define _LINUX_LINKAGE_H | ||||
11 | |||||
12 | #include <asm/linkage.h> | ||||
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 13 | |
Chen Gang | f5f9f4a | 2015-02-19 18:51:27 +0300 | [diff] [blame] | 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 | |||||
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 19 | #ifdef __cplusplus |
20 | #define CPP_ASMLINKAGE extern "C" | ||||
21 | #else | ||||
22 | #define CPP_ASMLINKAGE | ||||
23 | #endif | ||||
24 | |||||
Masahiro Yamada | d0506f7 | 2014-12-03 17:36:57 +0900 | [diff] [blame] | 25 | #ifndef asmlinkage |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 26 | #define asmlinkage CPP_ASMLINKAGE |
Masahiro Yamada | d0506f7 | 2014-12-03 17:36:57 +0900 | [diff] [blame] | 27 | #endif |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 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 | |||||
Aneesh V | 2fd2bc9 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 37 | #ifndef __ALIGN |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 38 | #define __ALIGN .align 4 |
Aneesh V | 2fd2bc9 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 39 | #endif |
40 | |||||
41 | #ifndef __ALIGN_STR | ||||
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 42 | #define __ALIGN_STR ".align 4" |
Aneesh V | 2fd2bc9 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 43 | #endif |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 44 | |
45 | #ifdef __ASSEMBLY__ | ||||
46 | |||||
47 | #define ALIGN __ALIGN | ||||
48 | #define ALIGN_STR __ALIGN_STR | ||||
49 | |||||
50 | #define LENTRY(name) \ | ||||
Chen Gang | f5f9f4a | 2015-02-19 18:51:27 +0300 | [diff] [blame] | 51 | ALIGN ASM_NL \ |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 52 | SYMBOL_NAME_LABEL(name) |
53 | |||||
54 | #define ENTRY(name) \ | ||||
Chen Gang | f5f9f4a | 2015-02-19 18:51:27 +0300 | [diff] [blame] | 55 | .globl SYMBOL_NAME(name) ASM_NL \ |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 56 | LENTRY(name) |
57 | |||||
David Feng | d7cb068 | 2013-12-14 11:47:31 +0800 | [diff] [blame] | 58 | #define WEAK(name) \ |
Chen Gang | f5f9f4a | 2015-02-19 18:51:27 +0300 | [diff] [blame] | 59 | .weak SYMBOL_NAME(name) ASM_NL \ |
David Feng | d7cb068 | 2013-12-14 11:47:31 +0800 | [diff] [blame] | 60 | LENTRY(name) |
61 | |||||
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 62 | #ifndef END |
63 | #define END(name) \ | ||||
64 | .size name, .-name | ||||
65 | #endif | ||||
66 | |||||
67 | #ifndef ENDPROC | ||||
68 | #define ENDPROC(name) \ | ||||
Chen Gang | f5f9f4a | 2015-02-19 18:51:27 +0300 | [diff] [blame] | 69 | .type name STT_FUNC ASM_NL \ |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 70 | END(name) |
71 | #endif | ||||
72 | |||||
73 | #endif | ||||
74 | |||||
75 | #endif |