1/*
2 * Copyright 2014, General Dynamics C4 Systems
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#pragma once
8
9/* This file contains useful macros for assembly code. */
10
11#ifdef __ASSEMBLER__
12
13/*
14 * Use BEGIN_FUNC(), END_FUNC() around assembly functions to annotate them
15 * correctly to the assembler.
16 */
17#define BEGIN_FUNC(_name) \
18    .global _name ; \
19    .type _name, %function ; \
20_name:
21
22#define END_FUNC(_name) \
23    .size _name, .-_name
24
25/*
26 * BEGIN_FUNC_STATIC() and END_FUNC_STATIC() do as above, but without making a
27 * global declaration. (c.f. static functions in C).
28 */
29#define BEGIN_FUNC_STATIC(_name) \
30    .type _name, %function ; \
31_name:
32
33#define END_FUNC_STATIC(_name) \
34    .size _name, .-_name
35
36#else /* !__ASSEMBLER__ */
37#warning "Including assembly-specific header in C code"
38#endif
39
40
41
42