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