[RFC,03/19] riscv: Add ENTRY_ALIGN() macro

Message ID 20230207001618.458947-4-christoph.muellner@vrull.eu
State New
Headers
Series riscv: ifunc support with optimized mem*/str*/cpu_relax routines |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Christoph Müllner Feb. 7, 2023, 12:16 a.m. UTC
  From: Christoph Müllner <christoph.muellner@vrull.eu>

This patch adds an ENTRY_ALIGN() macro to generate
aligned function symbols in assembly files.
Since the LEAF() macro is a special-case of that,
we change LEAF() to be reflect this.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
 sysdeps/riscv/sys/asm.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
  

Patch

diff --git a/sysdeps/riscv/sys/asm.h b/sysdeps/riscv/sys/asm.h
index b782cfa2f2..de6394b984 100644
--- a/sysdeps/riscv/sys/asm.h
+++ b/sysdeps/riscv/sys/asm.h
@@ -46,14 +46,18 @@ 
 # endif
 #endif
 
-/* Declare leaf routine.  */
-#define	LEAF(symbol)				\
-		.globl	symbol;			\
-		.align	2;			\
-		.type	symbol,@function;	\
+/* Define an entry point visible from C with custom p2-alignment.  */
+#define	ENTRY_ALIGN(symbol, align)		\
+		.globl symbol;			\
+		.p2align align;			\
+		.type symbol,@function;		\
 		C_LABEL(symbol)			\
 		cfi_startproc;
 
+/* Declare leaf routine.  */
+#define	LEAF(symbol)				\
+	ENTRY_ALIGN (symbol, 1)
+
 /* Mark end of function.  */
 #undef END
 #define END(function)				\