From 7f4c04755ef84feba6c24b34b539330e5ee2bd4d Mon Sep 17 00:00:00 2001 From: Xianmiao Qu Date: Fri, 13 Jan 2023 20:46:47 +0800 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.43.5