1 /* SPDX-License-Identifier: MIT */
5 * Copyright (c) 2019, Arm Limited.
11 #if defined(__aarch64__)
13 /* Branch Target Identitication support. */
16 /* Return address signing support (pac-ret). */
17 #define PACIASP hint 25; .cfi_window_save
18 #define AUTIASP hint 29; .cfi_window_save
20 /* GNU_PROPERTY_AARCH64_* macros from elf.h. */
21 #define FEATURE_1_AND 0xc0000000
22 #define FEATURE_1_BTI 1
23 #define FEATURE_1_PAC 2
25 /* Add a NT_GNU_PROPERTY_TYPE_0 note. */
26 #define GNU_PROPERTY(type, value) \
27 .section .note.gnu.property, "a"; \
39 /* If set then the GNU Property Note section will be added to
40 mark objects to support BTI and PAC-RET. */
41 #ifndef WANT_GNU_PROPERTY
42 #define WANT_GNU_PROPERTY 1
46 /* Add property note with supported features to all asm files. */
47 GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC)
50 #define ENTRY_ALIGN(name, alignment) \
52 .type name,%function; \
62 #define ENTRY_ALIGN(name, alignment) \
64 .type name,%function; \
71 #define ENTRY(name) ENTRY_ALIGN(name, 6)
73 #define ENTRY_ALIAS(name) \
75 .type name,%function; \
85 /* Sanitize padding bits of pointer arguments as per aapcs64 */
86 #define PTR_ARG(n) mov w##n, w##n
92 /* Sanitize padding bits of size arguments as per aapcs64 */
93 #define SIZE_ARG(n) mov w##n, w##n