public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] libgloss: csky: use atexit to call fini-array functions.
@ 2023-01-13 12:46 Xianmiao Qu
  2023-01-13 13:10 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Xianmiao Qu @ 2023-01-13 12:46 UTC (permalink / raw)
  To: newlib, vinschen

__libc_fini_array should be called upon exit to call the
global termination functions in fini-array, use atexit to
register it at __start.
---
 libgloss/csky/crt0.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libgloss/csky/crt0.S b/libgloss/csky/crt0.S
index a0651a734..49f7da364 100644
--- a/libgloss/csky/crt0.S
+++ b/libgloss/csky/crt0.S
@@ -150,6 +150,8 @@ __start:
 	 * Assember start up done, C codes start here.
 	 */
 __goto_c:
+	lrw     r0, __libc_fini_array   # Register global termination functions
+	jbsr    atexit                  #  to be called upon exit
 	/*jsri	main*/
 	lrw	r5, __libc_init_array
 	jsr	r5
-- 
2.32.1 (Apple Git-133)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-13 13:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230110075927.1937-1-cooper.qu@linux.alibaba.com>
2023-01-13  2:07 ` [PATCH] libgloss: csky: use atexit to call fini-array functions 瞿仙淼
2023-01-13 10:11   ` Corinna Vinschen
2023-01-13 12:46 Xianmiao Qu
2023-01-13 13:10 ` Corinna Vinschen

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).