Module Name: src Committed By: christos Date: Thu Dec 27 19:32:32 UTC 2018
Modified Files: src/lib/csu/common: crt0-common.c crtbegin.c Log Message: Allow both array and non-array constructors for transition. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/lib/csu/common/crt0-common.c cvs rdiff -u -r1.14 -r1.15 src/lib/csu/common/crtbegin.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.20 src/lib/csu/common/crt0-common.c:1.21 --- src/lib/csu/common/crt0-common.c:1.20 Mon Nov 26 12:37:46 2018 +++ src/lib/csu/common/crt0-common.c Thu Dec 27 14:32:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: crt0-common.c,v 1.20 2018/11/26 17:37:46 joerg Exp $ */ +/* $NetBSD: crt0-common.c,v 1.21 2018/12/27 19:32:32 christos Exp $ */ /* * Copyright (c) 1998 Christos Zoulas @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: crt0-common.c,v 1.20 2018/11/26 17:37:46 joerg Exp $"); +__RCSID("$NetBSD: crt0-common.c,v 1.21 2018/12/27 19:32:32 christos Exp $"); #include <sys/types.h> #include <sys/exec.h> @@ -50,10 +50,9 @@ extern int main(int, char **, char **); #ifdef HAVE_INITFINI_ARRAY typedef void (*fptr_t)(void); -#else +#endif extern void _init(void); extern void _fini(void); -#endif extern void _libc_init(void); /* @@ -111,7 +110,7 @@ _preinit(void) } static inline void -_init(void) +_initarray(void) { for (const fptr_t *f = __init_array_start; f < __init_array_end; f++) { (*f)(); @@ -119,7 +118,7 @@ _init(void) } static void -_fini(void) +_finiarray(void) { for (const fptr_t *f = __fini_array_start; f < __fini_array_end; f++) { (*f)(); @@ -337,6 +336,10 @@ ___start(void (*cleanup)(void), /* fro #endif atexit(_fini); +#ifdef HAVE_INITFINI_ARRAY + atexit(_finiarray); + _initarray(); +#endif _init(); exit(main(ps_strings->ps_nargvstr, ps_strings->ps_argvstr, environ)); Index: src/lib/csu/common/crtbegin.c diff -u src/lib/csu/common/crtbegin.c:1.14 src/lib/csu/common/crtbegin.c:1.15 --- src/lib/csu/common/crtbegin.c:1.14 Tue Jul 18 10:34:19 2017 +++ src/lib/csu/common/crtbegin.c Thu Dec 27 14:32:32 2018 @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: crtbegin.c,v 1.14 2017/07/18 14:34:19 joerg Exp $"); +__RCSID("$NetBSD: crtbegin.c,v 1.15 2018/12/27 19:32:32 christos Exp $"); #include "crtbegin.h" @@ -38,14 +38,12 @@ __dso_hidden const fptr_t __JCR_LIST__[0 __weakref_visible void Jv_RegisterClasses(const fptr_t *) __weak_reference(_Jv_RegisterClasses); -#if !defined(HAVE_INITFINI_ARRAY) extern __dso_hidden const fptr_t __CTOR_LIST__start __asm("__CTOR_LIST__"); __dso_hidden const fptr_t __aligned(sizeof(void *)) __CTOR_LIST__[] __section(".ctors") = { (fptr_t) -1, }; __dso_hidden extern const fptr_t __CTOR_LIST_END__[]; -#endif #ifdef SHARED __dso_hidden void *__dso_handle = &__dso_handle;