Re: [PATCH] libgloss: csky: use atexit to call fini-ar ray functions.

"瞿仙淼" <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <41528e9f-1b8c-4ca0-a2bd-1341e683dca8.xianmiao.qxm@alibaba-inc.com>
Hi,
Could someone review this patch? This is a small change, I would appreciate it if anyone would like to review.
Thanks,
Cooper
------------------------------------------------------------------
From:Xianmiao Qu <[email protected]>
Sent At:2023 Jan. 10 (Tue.) 15:59
To:newlib <[email protected]>
Cc:Xianmiao Qu <[email protected]>
Subject:[PATCH] libgloss: csky: use atexit to call fini-array functions.
__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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.