[1/2] LoongArch: Redefine macro LEAF/ENTRY.

Message ID 20230801070902.1385953-2-dengjianbo@loongson.cn
State Superseded
Headers
Series Add ifunc support and different versions of strlen |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed

Commit Message

dengjianbo Aug. 1, 2023, 7:09 a.m. UTC
  The following usage of macro LEAF/ENTRY are all feasible:
1. LEAF(fcn) -- the align value of fcn is .align 3(default value)
2. LEAF(fcn, 6) -- the align value of fcn is .align 6
---
 sysdeps/loongarch/sys/asm.h | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)
  

Patch

diff --git a/sysdeps/loongarch/sys/asm.h b/sysdeps/loongarch/sys/asm.h
index d1a279b8fb..c5eb8afa09 100644
--- a/sysdeps/loongarch/sys/asm.h
+++ b/sysdeps/loongarch/sys/asm.h
@@ -39,16 +39,32 @@ 
 #define FREG_L fld.d
 #define FREG_S fst.d
 
-/* Declare leaf routine.  */
-#define LEAF(symbol) \
-  .text; \
-  .globl symbol; \
-  .align 3; \
-  cfi_startproc; \
-  .type symbol, @function; \
-  symbol:
-
-#define ENTRY(symbol) LEAF (symbol)
+/*  Declare leaf routine.
+    The usage of macro LEAF/ENTRY is as follows:
+    1. LEAF(fcn) -- the align value of fcn is .align 3 (default value)
+    2. LEAF(fcn, 6) -- the align value of fcn is .align 6
+*/
+#define LEAF_IMPL(symbol, aln, ...)	\
+	.text;				\
+	.globl symbol;			\
+	.align aln;			\
+	.type symbol, @function;	\
+symbol: \
+	cfi_startproc;
+
+
+#define LEAF(...) LEAF_IMPL(__VA_ARGS__, 3)
+#define ENTRY(...) LEAF(__VA_ARGS__)
+
+#define	LEAF_NO_ALIGN(symbol)		\
+	.text;				\
+	.globl	symbol;			\
+	.type	symbol, @function;	\
+symbol: \
+	cfi_startproc;
+
+#define ENTRY_NO_ALIGN(symbol) LEAF_NO_ALIGN(symbol)
+
 
 /* Mark end of function.  */
 #undef END