[newlib-cygwin/main] libgloss: mips: Support Lite Exit in crt0

Corinna Vinschen corinna@sourceware.org
Mon Dec 22 11:57:44 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1a768f3b959227a943385d767270431d9146f2b9

commit 1a768f3b959227a943385d767270431d9146f2b9
Author:     Spencer Alves <impiaaa@gmail.com>
AuthorDate: Fri Dec 19 11:49:29 2025 -0800
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Dec 22 12:57:32 2025 +0100

    libgloss: mips: Support Lite Exit in crt0
    
    Based on the equivalent code in ARM

Diff:
---
 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 ac6e614df71a..8ca028402752 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


More information about the Newlib-cvs mailing list