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