Re: [PATCH] libgloss: mips: Support Lite Exit in crt0

Corinna Vinschen <[email protected]> Mon, 22 Dec 2025 12:57:53 +0100
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Dec 19 11:49, Spencer Alves wrote:
> 
> 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

Pushed.

Thanks,
Corinna