1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* Copyright (c) 2014, STMicroelectronics International N.V.
* Copyright (c) 2020, Linaro Limited
*/
#if defined(__aarch64__)
#include <arm64_bti.S>
#elif defined(__riscv)
#include <riscv.S>
#endif
#if defined(__aarch64__) && \
(((defined(__KERNEL__) || defined(__LDELF__)) && defined(CFG_CORE_BTI)) || \
(!(defined(__KERNEL__) || defined(__LDELF__)) && defined(CFG_TA_BTI)))
#define BTI(...) __VA_ARGS__
#else
#define BTI(...)
#endif
#if defined(CFG_UNWIND) && defined(__arm__)
#define UNWIND(...) __VA_ARGS__
#else
#define UNWIND(...)
#endif
.macro FUNC name colon section=default align=4 _bti=default
.ifc \section\(),default
.section .text.\name
.else
.section \section , "ax" , %progbits
.endif
.global \name
.type \name , %function
.balign \align
\name \colon
UNWIND( .fnstart)
.ifc \_bti\(),default
BTI( bti c)
.endif
.endm
.macro LOCAL_FUNC name colon section=default align=4 _bti=default
.ifc \section\(),default
.section .text.\name
.else
.section \section , "ax" , %progbits
.endif
.type \name , %function
.balign \align
\name \colon
UNWIND( .fnstart)
.ifc \_bti\(),default
BTI( bti c)
.endif
.endm
.macro WEAK_FUNC name colon section=default align=4 _bti=default
.ifc \section\(),default
.section .text.\name
.else
.section \section , "ax" , %progbits
.endif
.weak \name
.type \name , %function
.balign \align
\name \colon
UNWIND( .fnstart)
.ifc \_bti\(),default
BTI( bti c)
.endif
.endm
.macro END_FUNC name
UNWIND( .fnend)
.size \name , .-\name
.endm
.macro DATA name colon
.global \name
.type \name , %object
\name \colon
.endm
.macro LOCAL_DATA name colon
.type \name , %object
\name \colon
.endm
.macro END_DATA name
.size \name , .-\name
.endm
|