summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-12-24 19:29:13 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-12-24 19:29:13 +0000
commit3efd477b5c201c94a2332fc9849a74d85eb8d2e2 (patch)
treeaae3c8132ef7a1d544be795607d6779c76a77062
parent79fd376bdee18d9e8238c979581078aa69e217c2 (diff)
Register cleanup handler passed by ld.so with atexit(3).
tested by benno@
-rw-r--r--lib/csu/sparc/crt0.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/csu/sparc/crt0.c b/lib/csu/sparc/crt0.c
index c05f40d6dfc..43cc5ac5301 100644
--- a/lib/csu/sparc/crt0.c
+++ b/lib/csu/sparc/crt0.c
@@ -38,7 +38,7 @@
#include <stdlib.h>
#include <limits.h>
-void ___start(int, char **, char **, void (*cleanup)(void), void *);
+void ___start(int, char **, char **, void (*cleanup)(void));
__asm(
" .text\n"
@@ -55,10 +55,8 @@ __asm(
" add %o1, %o2, %o2\n"
" andn %sp, 7, %sp ! align\n"
" sub %sp, 24, %sp ! expand to standard stack frame size\n"
-" mov %g3, %o3\n"
-" mov %g2, %o4\n"
" call ___start\n"
-" mov %g1, %o5\n"
+" mov %g1, %o3\n"
);
char **environ;
@@ -74,8 +72,7 @@ extern unsigned char _etext, _eprol;
static char *_strrchr(const char *, char);
void
-___start(int argc, char **argv, char **envp, void (*cleanup)(void),
- void *obj)
+___start(int argc, char **argv, char **envp, void (*cleanup)(void))
{
char *s;
@@ -93,6 +90,9 @@ ___start(int argc, char **argv, char **envp, void (*cleanup)(void),
__progname = __progname_storage;
}
+ if (cleanup)
+ atexit(cleanup);
+
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);