blob: 5797498adceceb48c5368d91c3155a59daadb094 [file] [log] [blame]
Macpaul Lin32ff4082011-12-01 12:32:10 +08001/*
2 * U-boot - linkage.h
3 *
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
14#ifdef __cplusplus
15#define CPP_ASMLINKAGE extern "C"
16#else
17#define CPP_ASMLINKAGE
18#endif
19
Masahiro Yamadad0506f72014-12-03 17:36:57 +090020#ifndef asmlinkage
Macpaul Lin32ff4082011-12-01 12:32:10 +080021#define asmlinkage CPP_ASMLINKAGE
Masahiro Yamadad0506f72014-12-03 17:36:57 +090022#endif
Macpaul Lin32ff4082011-12-01 12:32:10 +080023
24#define SYMBOL_NAME_STR(X) #X
25#define SYMBOL_NAME(X) X
26#ifdef __STDC__
27#define SYMBOL_NAME_LABEL(X) X##:
28#else
29#define SYMBOL_NAME_LABEL(X) X:
30#endif
31
Aneesh V2fd2bc92012-03-08 07:20:17 +000032#ifndef __ALIGN
Macpaul Lin32ff4082011-12-01 12:32:10 +080033#define __ALIGN .align 4
Aneesh V2fd2bc92012-03-08 07:20:17 +000034#endif
35
36#ifndef __ALIGN_STR
Macpaul Lin32ff4082011-12-01 12:32:10 +080037#define __ALIGN_STR ".align 4"
Aneesh V2fd2bc92012-03-08 07:20:17 +000038#endif
Macpaul Lin32ff4082011-12-01 12:32:10 +080039
40#ifdef __ASSEMBLY__
41
42#define ALIGN __ALIGN
43#define ALIGN_STR __ALIGN_STR
44
45#define LENTRY(name) \
46 ALIGN; \
47 SYMBOL_NAME_LABEL(name)
48
49#define ENTRY(name) \
50 .globl SYMBOL_NAME(name); \
51 LENTRY(name)
52
David Fengd7cb0682013-12-14 11:47:31 +080053#define WEAK(name) \
54 .weak SYMBOL_NAME(name); \
55 LENTRY(name)
56
Macpaul Lin32ff4082011-12-01 12:32:10 +080057#ifndef END
58#define END(name) \
59 .size name, .-name
60#endif
61
62#ifndef ENDPROC
63#define ENDPROC(name) \
Aneesh V2fd2bc92012-03-08 07:20:17 +000064 .type name STT_FUNC; \
Macpaul Lin32ff4082011-12-01 12:32:10 +080065 END(name)
66#endif
67
68#endif
69
70#endif