Module Name:    src
Committed By:   christos
Date:           Sat Mar 22 16:59:02 UTC 2025

Modified Files:
        src/lib/csu/common: crt0-common.c

Log Message:
PR/59189: RVP: move atexit(cleanup) after _preinit() to allow sanitizer
initialization during preinit as well as atexit interception.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/csu/common/crt0-common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.28 src/lib/csu/common/crt0-common.c:1.29
--- src/lib/csu/common/crt0-common.c:1.28	Fri Jan 19 14:22:17 2024
+++ src/lib/csu/common/crt0-common.c	Sat Mar 22 12:59:02 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.28 2024/01/19 19:22:17 christos Exp $ */
+/* $NetBSD: crt0-common.c,v 1.29 2025/03/22 16:59:02 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: crt0-common.c,v 1.28 2024/01/19 19:22:17 christos Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.29 2025/03/22 16:59:02 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/exec.h>
@@ -317,9 +317,6 @@ ___start(void (*cleanup)(void),			/* fro
 		__progname = empty_string;
 	}
 
-	if (cleanup != NULL)
-		atexit(cleanup);
-
 	_libc_init();
 
 	if (&rtld_DYNAMIC == NULL) {
@@ -333,6 +330,9 @@ ___start(void (*cleanup)(void),			/* fro
 
 	_preinit();
 
+	if (cleanup != NULL)
+		atexit(cleanup);
+
 #ifdef MCRT0
 	atexit(_mcleanup);
 	monstartup((u_long)&__eprol, (u_long)&__etext);

Reply via email to