public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] LoongArch: Redefine macro LEAF/ENTRY.
@ 2023-08-14  3:31 Yinyu Cai
  0 siblings, 0 replies; only message in thread
From: Yinyu Cai @ 2023-08-14  3:31 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=57b2c14272998c0ea08c005edbd90887c2d5fa6b

commit 57b2c14272998c0ea08c005edbd90887c2d5fa6b
Author: dengjianbo <dengjianbo@loongson.cn>
Date:   Tue Aug 8 14:15:42 2023 +0800

    LoongArch: Redefine macro LEAF/ENTRY.
    
    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

Diff:
---
 sysdeps/loongarch/sys/asm.h | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-14  3:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-14  3:31 [glibc] LoongArch: Redefine macro LEAF/ENTRY Yinyu Cai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).