Macpaul Lin | 32ff408 | 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 | 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 | |
| 14 | #ifdef __cplusplus |
| 15 | #define CPP_ASMLINKAGE extern "C" |
| 16 | #else |
| 17 | #define CPP_ASMLINKAGE |
| 18 | #endif |
| 19 | |
| 20 | #define asmlinkage CPP_ASMLINKAGE |
| 21 | |
| 22 | #define SYMBOL_NAME_STR(X) #X |
| 23 | #define SYMBOL_NAME(X) X |
| 24 | #ifdef __STDC__ |
| 25 | #define SYMBOL_NAME_LABEL(X) X##: |
| 26 | #else |
| 27 | #define SYMBOL_NAME_LABEL(X) X: |
| 28 | #endif |
| 29 | |
Aneesh V | 2fd2bc9 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 30 | #ifndef __ALIGN |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 31 | #define __ALIGN .align 4 |
Aneesh V | 2fd2bc9 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 32 | #endif |
| 33 | |
| 34 | #ifndef __ALIGN_STR |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 35 | #define __ALIGN_STR ".align 4" |
Aneesh V | 2fd2bc9 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 36 | #endif |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 37 | |
| 38 | #ifdef __ASSEMBLY__ |
| 39 | |
| 40 | #define ALIGN __ALIGN |
| 41 | #define ALIGN_STR __ALIGN_STR |
| 42 | |
| 43 | #define LENTRY(name) \ |
| 44 | ALIGN; \ |
| 45 | SYMBOL_NAME_LABEL(name) |
| 46 | |
| 47 | #define ENTRY(name) \ |
| 48 | .globl SYMBOL_NAME(name); \ |
| 49 | LENTRY(name) |
| 50 | |
David Feng | d7cb068 | 2013-12-14 11:47:31 +0800 | [diff] [blame] | 51 | #define WEAK(name) \ |
| 52 | .weak SYMBOL_NAME(name); \ |
| 53 | LENTRY(name) |
| 54 | |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 55 | #ifndef END |
| 56 | #define END(name) \ |
| 57 | .size name, .-name |
| 58 | #endif |
| 59 | |
| 60 | #ifndef ENDPROC |
| 61 | #define ENDPROC(name) \ |
Aneesh V | 2fd2bc9 | 2012-03-08 07:20:17 +0000 | [diff] [blame] | 62 | .type name STT_FUNC; \ |
Macpaul Lin | 32ff408 | 2011-12-01 12:32:10 +0800 | [diff] [blame] | 63 | END(name) |
| 64 | #endif |
| 65 | |
| 66 | #endif |
| 67 | |
| 68 | #endif |