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