Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 1 | /* |
2 | * U-boot - linkage.h | ||||
3 | * | ||||
4 | * Copyright (c) 2005-2007 Analog Devices Inc. | ||||
5 | * | ||||
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Macpaul Lin | 273d11e | 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 | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 13 | |
Chen Gang | 950cb9b | 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 | 273d11e | 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 | e6126a5 | 2014-12-03 17:36:57 +0900 | [diff] [blame] | 25 | #ifndef asmlinkage |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 26 | #define asmlinkage CPP_ASMLINKAGE |
Masahiro Yamada | e6126a5 | 2014-12-03 17:36:57 +0900 | [diff] [blame] | 27 | #endif |
Macpaul Lin | 273d11e | 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 | 7245536 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 37 | #ifndef __ALIGN |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 38 | #define __ALIGN .align 4 |
Aneesh V | 7245536 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 39 | #endif |
40 | |||||
41 | #ifndef __ALIGN_STR | ||||
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 42 | #define __ALIGN_STR ".align 4" |
Aneesh V | 7245536 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 43 | #endif |
Macpaul Lin | 273d11e | 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 | 950cb9b | 2015-02-19 18:51:27 +0300 | [diff] [blame] | 51 | ALIGN ASM_NL \ |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 52 | SYMBOL_NAME_LABEL(name) |
53 | |||||
54 | #define ENTRY(name) \ | ||||
Chen Gang | 950cb9b | 2015-02-19 18:51:27 +0300 | [diff] [blame] | 55 | .globl SYMBOL_NAME(name) ASM_NL \ |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 56 | LENTRY(name) |
57 | |||||
David Feng | ec4fa56 | 2013-12-14 11:47:31 +0800 | [diff] [blame] | 58 | #define WEAK(name) \ |
Chen Gang | 950cb9b | 2015-02-19 18:51:27 +0300 | [diff] [blame] | 59 | .weak SYMBOL_NAME(name) ASM_NL \ |
David Feng | ec4fa56 | 2013-12-14 11:47:31 +0800 | [diff] [blame] | 60 | LENTRY(name) |
61 | |||||
Macpaul Lin | 273d11e | 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 | 950cb9b | 2015-02-19 18:51:27 +0300 | [diff] [blame] | 69 | .type name STT_FUNC ASM_NL \ |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 70 | END(name) |
71 | #endif | ||||
72 | |||||
73 | #endif | ||||
74 | |||||
75 | #endif |