blob: 8e2f15a63529b391affc44be5cdc5fffcb7542f1 [file] [log] [blame]
Macpaul Lin32ff4082011-12-01 12:32:10 +08001/*
Bin Meng75574052016-02-05 19:30:11 -08002 * U-Boot - linkage.h
Macpaul Lin32ff4082011-12-01 12:32:10 +08003 *
4 * Copyright (c) 2005-2007 Analog Devices Inc.
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Macpaul Lin32ff4082011-12-01 12:32:10 +08007 */
8
9#ifndef _LINUX_LINKAGE_H
10#define _LINUX_LINKAGE_H
11
12#include <asm/linkage.h>
Macpaul Lin32ff4082011-12-01 12:32:10 +080013
Chen Gangf5f9f4a2015-02-19 18:51:27 +030014/* 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 Lin32ff4082011-12-01 12:32:10 +080019#ifdef __cplusplus
20#define CPP_ASMLINKAGE extern "C"
21#else
22#define CPP_ASMLINKAGE
23#endif
24
Masahiro Yamadad0506f72014-12-03 17:36:57 +090025#ifndef asmlinkage
Macpaul Lin32ff4082011-12-01 12:32:10 +080026#define asmlinkage CPP_ASMLINKAGE
Masahiro Yamadad0506f72014-12-03 17:36:57 +090027#endif
Macpaul Lin32ff4082011-12-01 12:32:10 +080028
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 V2fd2bc92012-03-08 07:20:17 +000037#ifndef __ALIGN
Macpaul Lin32ff4082011-12-01 12:32:10 +080038#define __ALIGN .align 4
Aneesh V2fd2bc92012-03-08 07:20:17 +000039#endif
40
41#ifndef __ALIGN_STR
Macpaul Lin32ff4082011-12-01 12:32:10 +080042#define __ALIGN_STR ".align 4"
Aneesh V2fd2bc92012-03-08 07:20:17 +000043#endif
Macpaul Lin32ff4082011-12-01 12:32:10 +080044
45#ifdef __ASSEMBLY__
46
47#define ALIGN __ALIGN
48#define ALIGN_STR __ALIGN_STR
49
50#define LENTRY(name) \
Chen Gangf5f9f4a2015-02-19 18:51:27 +030051 ALIGN ASM_NL \
Macpaul Lin32ff4082011-12-01 12:32:10 +080052 SYMBOL_NAME_LABEL(name)
53
54#define ENTRY(name) \
Chen Gangf5f9f4a2015-02-19 18:51:27 +030055 .globl SYMBOL_NAME(name) ASM_NL \
Macpaul Lin32ff4082011-12-01 12:32:10 +080056 LENTRY(name)
57
David Fengd7cb0682013-12-14 11:47:31 +080058#define WEAK(name) \
Chen Gangf5f9f4a2015-02-19 18:51:27 +030059 .weak SYMBOL_NAME(name) ASM_NL \
David Fengd7cb0682013-12-14 11:47:31 +080060 LENTRY(name)
61
Macpaul Lin32ff4082011-12-01 12:32:10 +080062#ifndef END
63#define END(name) \
64 .size name, .-name
65#endif
66
67#ifndef ENDPROC
68#define ENDPROC(name) \
Chen Gangf5f9f4a2015-02-19 18:51:27 +030069 .type name STT_FUNC ASM_NL \
Macpaul Lin32ff4082011-12-01 12:32:10 +080070 END(name)
71#endif
72
73#endif
74
75#endif