Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/csu/common Allow both array and non-array constructors f...



details:   https://anonhg.NetBSD.org/src/rev/69b823c139a2
branches:  trunk
changeset: 446998:69b823c139a2
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Dec 27 19:32:32 2018 +0000

description:
Allow both array and non-array constructors for transition.

diffstat:

 lib/csu/common/crt0-common.c |  15 +++++++++------
 lib/csu/common/crtbegin.c    |   4 +---
 2 files changed, 10 insertions(+), 9 deletions(-)

diffs (86 lines):

diff -r 4f0af633951e -r 69b823c139a2 lib/csu/common/crt0-common.c
--- a/lib/csu/common/crt0-common.c      Thu Dec 27 18:58:14 2018 +0000
+++ b/lib/csu/common/crt0-common.c      Thu Dec 27 19:32:32 2018 +0000
@@ -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 @@
 
 #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 @@
 }
 
 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 @@
 }
 
 static void
-_fini(void)
+_finiarray(void)
 {
        for (const fptr_t *f = __fini_array_start; f < __fini_array_end; f++) {
                (*f)();
@@ -337,6 +336,10 @@
 #endif
 
        atexit(_fini);
+#ifdef HAVE_INITFINI_ARRAY
+       atexit(_finiarray);
+       _initarray();
+#endif
        _init();
 
        exit(main(ps_strings->ps_nargvstr, ps_strings->ps_argvstr, environ));
diff -r 4f0af633951e -r 69b823c139a2 lib/csu/common/crtbegin.c
--- a/lib/csu/common/crtbegin.c Thu Dec 27 18:58:14 2018 +0000
+++ b/lib/csu/common/crtbegin.c Thu Dec 27 19:32:32 2018 +0000
@@ -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 @@
 __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;



Home | Main Index | Thread Index | Old Index