[PATCH] libgloss: mips: Support Lite Exit in crt0
Spencer Alves
impiaaa@gmail.com
Fri Dec 19 19:49:29 GMT 2025
From: Spencer Alves <impiaaa@gmail.com>
Based on the equivalent code in ARM
---
libgloss/mips/hal/crt0.S | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/libgloss/mips/hal/crt0.S b/libgloss/mips/hal/crt0.S
index ac6e614df..8ca028402 100644
--- a/libgloss/mips/hal/crt0.S
+++ b/libgloss/mips/hal/crt0.S
@@ -225,10 +225,21 @@ init:
beq t9,zero,1f
jalr t9
1:
+#ifdef _LITE_EXIT
+ # Make reference to atexit weak to avoid unconditionally pulling in
+ # support code. Refer to comments in __atexit.c for more details.
+ .weak atexit
+ LA t9, atexit
+ beq t9,zero,.Lweak_atexit
+ .weak _fini
+#endif
/* Register exit handlers */
LA a0, _fini
jal atexit
+#ifdef _LITE_EXIT
+.Lweak_atexit:
+#endif
/* run global constructors */
jal _init
--
2.51.0
More information about the Newlib
mailing list