xref: /optee_os/lib/libutils/ext/include/asm.S (revision 7901324d9530594155991c8b283023d567741cc7)
1/* SPDX-License-Identifier: BSD-2-Clause */
2/*
3 * Copyright (c) 2014, STMicroelectronics International N.V.
4 * Copyright (c) 2020, Linaro Limited
5 */
6
7#if defined(CFG_UNWIND) && defined(__arm__)
8#define UNWIND(...) __VA_ARGS__
9#else
10#define UNWIND(...)
11#endif
12
13	.macro FUNC name colon section=default align=4
14	.ifc	\section\(),default
15	.section .text.\name
16	.else
17	.section \section , "ax" , %progbits
18	.endif
19	.global \name
20	.type \name , %function
21	.balign \align
22	\name \colon
23UNWIND(	.fnstart)
24	.endm
25
26	.macro LOCAL_FUNC name colon section=default align=4
27	.ifc	\section\(),default
28	.section .text.\name
29	.else
30	.section \section , "ax" , %progbits
31	.endif
32	.type \name , %function
33	.balign \align
34	\name \colon
35UNWIND(	.fnstart)
36	.endm
37
38	.macro WEAK_FUNC name colon section=default align=4
39	.ifc	\section\(),default
40	.section .text.\name
41	.else
42	.section \section , "ax" , %progbits
43	.endif
44	.weak \name
45	.type \name , %function
46	.balign \align
47	\name \colon
48UNWIND(	.fnstart)
49	.endm
50
51	.macro END_FUNC name
52UNWIND(	.fnend)
53	.size \name , .-\name
54	.endm
55
56	.macro DATA name colon
57	.global \name
58	.type \name , %object
59	\name \colon
60	.endm
61
62	.macro LOCAL_DATA name colon
63	.type \name , %object
64	\name \colon
65	.endm
66
67	.macro END_DATA name
68	.size \name , .-\name
69	.endm
70