Import BTI related files from OP-TEE
The files were imported from:
https://github.com/OP-TEE/optee_os/tree/4.2.0
Signed-off-by: Gabor Toth <gabor.toth2@arm.com>
Change-Id: I8560ad3c7b124bd6a6f8c51331da34eb110396c8
diff --git a/components/common/utils/include/arm64_bti.S b/components/common/utils/include/arm64_bti.S
new file mode 100644
index 0000000..63f42c7
--- /dev/null
+++ b/components/common/utils/include/arm64_bti.S
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (c) 2021, Linaro Limited
+ */
+
+#include <elf_common.h>
+
+/*
+ * This macro emits a program property note section identifying
+ * architecture features which require special handling, mainly for
+ * use in assembly files in the libraries linked with TA's.
+ */
+
+.macro emit_aarch64_feature_1_and, feat
+ .pushsection .note.gnu.property, "a"
+ .align 3
+ .long 2f - 1f /* n_namesz */
+ .long 6f - 3f /* n_desc_sz */
+ .long NT_GNU_PROPERTY_TYPE_0 /* n_type */
+1: .string "GNU" /* name */
+2:
+ .align 3
+3: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type */
+ .long 5f - 4f /* pr_datasz */
+4:
+ /*
+ * This is described with an array of char in the Linux API
+ * spec but the text and all other usage (including binutils,
+ * clang and GCC) treat this as a 32 bit value so no swizzling
+ * is required for big endian.
+ */
+ .long \feat /* property */
+5:
+ .align 3
+6:
+ .popsection
+.endm