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 | |
| 14 | #ifdef __cplusplus |
| 15 | #define CPP_ASMLINKAGE extern "C" |
| 16 | #else |
| 17 | #define CPP_ASMLINKAGE |
| 18 | #endif |
| 19 | |
Masahiro Yamada | e6126a5 | 2014-12-03 17:36:57 +0900 | [diff] [blame] | 20 | #ifndef asmlinkage |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 21 | #define asmlinkage CPP_ASMLINKAGE |
Masahiro Yamada | e6126a5 | 2014-12-03 17:36:57 +0900 | [diff] [blame] | 22 | #endif |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 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 | |
Aneesh V | 7245536 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 32 | #ifndef __ALIGN |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 33 | #define __ALIGN .align 4 |
Aneesh V | 7245536 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 34 | #endif |
| 35 | |
| 36 | #ifndef __ALIGN_STR |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 37 | #define __ALIGN_STR ".align 4" |
Aneesh V | 7245536 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 38 | #endif |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 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 | |
David Feng | ec4fa56 | 2013-12-14 11:47:31 +0800 | [diff] [blame] | 53 | #define WEAK(name) \ |
| 54 | .weak SYMBOL_NAME(name); \ |
| 55 | LENTRY(name) |
| 56 | |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 57 | #ifndef END |
| 58 | #define END(name) \ |
| 59 | .size name, .-name |
| 60 | #endif |
| 61 | |
| 62 | #ifndef ENDPROC |
| 63 | #define ENDPROC(name) \ |
Aneesh V | 7245536 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 64 | .type name STT_FUNC; \ |
Macpaul Lin | 273d11e | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 65 | END(name) |
| 66 | #endif |
| 67 | |
| 68 | #endif |
| 69 | |
| 70 | #endif |