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