blob: 0b24111d6ae63a6f6cecbddedd0d25d77df9b9fa [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Macpaul Lin32ff4082011-12-01 12:32:10 +08002/*
Bin Meng75574052016-02-05 19:30:11 -08003 * U-Boot - linkage.h
Macpaul Lin32ff4082011-12-01 12:32:10 +08004 *
5 * Copyright (c) 2005-2007 Analog Devices Inc.
Macpaul Lin32ff4082011-12-01 12:32:10 +08006 */
7
8#ifndef _LINUX_LINKAGE_H
9#define _LINUX_LINKAGE_H
10
11#include <asm/linkage.h>
Macpaul Lin32ff4082011-12-01 12:32:10 +080012
Chen Gangf5f9f4a2015-02-19 18:51:27 +030013/* 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 Lin32ff4082011-12-01 12:32:10 +080018#ifdef __cplusplus
19#define CPP_ASMLINKAGE extern "C"
20#else
21#define CPP_ASMLINKAGE
22#endif
23
Masahiro Yamadad0506f72014-12-03 17:36:57 +090024#ifndef asmlinkage
Macpaul Lin32ff4082011-12-01 12:32:10 +080025#define asmlinkage CPP_ASMLINKAGE
Masahiro Yamadad0506f72014-12-03 17:36:57 +090026#endif
Macpaul Lin32ff4082011-12-01 12:32:10 +080027
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 V2fd2bc92012-03-08 07:20:17 +000036#ifndef __ALIGN
Macpaul Lin32ff4082011-12-01 12:32:10 +080037#define __ALIGN .align 4
Aneesh V2fd2bc92012-03-08 07:20:17 +000038#endif
39
40#ifndef __ALIGN_STR
Macpaul Lin32ff4082011-12-01 12:32:10 +080041#define __ALIGN_STR ".align 4"
Aneesh V2fd2bc92012-03-08 07:20:17 +000042#endif
Macpaul Lin32ff4082011-12-01 12:32:10 +080043
44#ifdef __ASSEMBLY__
45
46#define ALIGN __ALIGN
47#define ALIGN_STR __ALIGN_STR
48
49#define LENTRY(name) \
Chen Gangf5f9f4a2015-02-19 18:51:27 +030050 ALIGN ASM_NL \
Macpaul Lin32ff4082011-12-01 12:32:10 +080051 SYMBOL_NAME_LABEL(name)
52
53#define ENTRY(name) \
Chen Gangf5f9f4a2015-02-19 18:51:27 +030054 .globl SYMBOL_NAME(name) ASM_NL \
Macpaul Lin32ff4082011-12-01 12:32:10 +080055 LENTRY(name)
56
David Fengd7cb0682013-12-14 11:47:31 +080057#define WEAK(name) \
Chen Gangf5f9f4a2015-02-19 18:51:27 +030058 .weak SYMBOL_NAME(name) ASM_NL \
David Fengd7cb0682013-12-14 11:47:31 +080059 LENTRY(name)
60
Macpaul Lin32ff4082011-12-01 12:32:10 +080061#ifndef END
62#define END(name) \
63 .size name, .-name
64#endif
65
66#ifndef ENDPROC
67#define ENDPROC(name) \
Chen Gangf5f9f4a2015-02-19 18:51:27 +030068 .type name STT_FUNC ASM_NL \
Macpaul Lin32ff4082011-12-01 12:32:10 +080069 END(name)
70#endif
71
72#endif
73
74#endif