[PATCH] libgloss: mips: Support Lite Exit in crt0
Spencer Alves <[email protected]> Fri, 19 Dec 2025 11:49:29 -0800
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
From: Spencer Alves <[email protected]> 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