summaryrefslogtreecommitdiff
path: root/arch/riscv/include/asm/assembler.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/riscv/include/asm/assembler.h')
-rw-r--r--arch/riscv/include/asm/assembler.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/arch/riscv/include/asm/assembler.h b/arch/riscv/include/asm/assembler.h
index 44b1457d3e95..ed4ffde27f80 100644
--- a/arch/riscv/include/asm/assembler.h
+++ b/arch/riscv/include/asm/assembler.h
@@ -5,7 +5,7 @@
* Author: Jee Heng Sia <jeeheng.sia@starfivetech.com>
*/
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#error "Only include this from assembly code"
#endif
@@ -80,3 +80,47 @@
.endm
#endif /* __ASM_ASSEMBLER_H */
+
+#if defined(CONFIG_RISCV_USER_CFI) && (__riscv_xlen == 64)
+.macro vdso_lpad
+lpad 0
+.endm
+#else
+.macro vdso_lpad
+.endm
+#endif
+
+/*
+ * This macro emits a program property note section identifying
+ * architecture features which require special handling, mainly for
+ * use in assembly files included in the VDSO.
+ */
+#define NT_GNU_PROPERTY_TYPE_0 5
+#define GNU_PROPERTY_RISCV_FEATURE_1_AND 0xc0000000
+
+#define GNU_PROPERTY_RISCV_FEATURE_1_ZICFILP (1U << 0)
+#define GNU_PROPERTY_RISCV_FEATURE_1_ZICFISS (1U << 1)
+
+#if defined(CONFIG_RISCV_USER_CFI) && (__riscv_xlen == 64)
+#define GNU_PROPERTY_RISCV_FEATURE_1_DEFAULT \
+ (GNU_PROPERTY_RISCV_FEATURE_1_ZICFILP | GNU_PROPERTY_RISCV_FEATURE_1_ZICFISS)
+#endif
+
+#ifdef GNU_PROPERTY_RISCV_FEATURE_1_DEFAULT
+.macro emit_riscv_feature_1_and, feat = GNU_PROPERTY_RISCV_FEATURE_1_DEFAULT
+ .pushsection .note.gnu.property, "a"
+ .p2align 3
+ .word 4
+ .word 16
+ .word NT_GNU_PROPERTY_TYPE_0
+ .asciz "GNU"
+ .word GNU_PROPERTY_RISCV_FEATURE_1_AND
+ .word 4
+ .word \feat
+ .word 0
+ .popsection
+.endm
+#else
+.macro emit_riscv_feature_1_and, feat = 0
+.endm
+#endif