diff options
author | 2012-09-08 20:08:33 +0000 | |
---|---|---|
committer | 2012-09-08 20:08:33 +0000 | |
commit | 195a2728498fa4d01244c8e88ba130b686a69875 (patch) | |
tree | e9ff3716346c901766e9b0cd1ce249cc63936ea8 | |
parent | Switch hp300 to timecounters. From NetBSD via martin@ (diff) | |
download | wireguard-openbsd-195a2728498fa4d01244c8e88ba130b686a69875.tar.xz wireguard-openbsd-195a2728498fa4d01244c8e88ba130b686a69875.zip |
Reverse the order that ctors and dtors are run in accordance with
GCC's documentation. Fixes GNU C++'s init_priority attribute.
ok miod
-rw-r--r-- | lib/csu/common_elf/crtbegin.c | 14 | ||||
-rw-r--r-- | lib/csu/common_elf/crtbeginS.c | 14 | ||||
-rw-r--r-- | lib/csu/crtbegin.c | 14 | ||||
-rw-r--r-- | lib/csu/crtbeginS.c | 14 |
4 files changed, 28 insertions, 28 deletions
diff --git a/lib/csu/common_elf/crtbegin.c b/lib/csu/common_elf/crtbegin.c index 325b9d9f1d3..f594675d78d 100644 --- a/lib/csu/common_elf/crtbegin.c +++ b/lib/csu/common_elf/crtbegin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtbegin.c,v 1.15 2012/08/28 16:39:09 matthew Exp $ */ +/* $OpenBSD: crtbegin.c,v 1.16 2012/09/08 20:08:33 matthew Exp $ */ /* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */ /* @@ -95,25 +95,25 @@ static void __dtors(void) __used; static void __ctors(void) __used; static void -__dtors() +__ctors() { - unsigned long i = (unsigned long) __DTOR_LIST__[0]; + unsigned long i = (unsigned long) __CTOR_LIST__[0]; const init_f *p; if (i == -1) { - for (i = 1; __DTOR_LIST__[i] != NULL; i++) + for (i = 1; __CTOR_LIST__[i] != NULL; i++) ; i--; } - p = __DTOR_LIST__ + i; + p = __CTOR_LIST__ + i; while (i--) (**p--)(); } static void -__ctors() +__dtors() { - const init_f *p = __CTOR_LIST__ + 1; + const init_f *p = __DTOR_LIST__ + 1; while (*p) (**p++)(); diff --git a/lib/csu/common_elf/crtbeginS.c b/lib/csu/common_elf/crtbeginS.c index 1938f3e09c3..b72698fe2b4 100644 --- a/lib/csu/common_elf/crtbeginS.c +++ b/lib/csu/common_elf/crtbeginS.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtbeginS.c,v 1.12 2012/08/28 16:39:09 matthew Exp $ */ +/* $OpenBSD: crtbeginS.c,v 1.13 2012/09/08 20:08:33 matthew Exp $ */ /* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */ /* @@ -84,26 +84,26 @@ static void __dtors(void) __used; static void __ctors(void) __used; void -__dtors(void) +__ctors(void) { - unsigned long i = (unsigned long) __DTOR_LIST__[0]; + unsigned long i = (unsigned long) __CTOR_LIST__[0]; init_f *p; if (i == -1) { - for (i = 1; __DTOR_LIST__[i] != NULL; i++) + for (i = 1; __CTOR_LIST__[i] != NULL; i++) ; i--; } - p = __DTOR_LIST__ + i; + p = __CTOR_LIST__ + i; while (i--) { (**p--)(); } } static void -__ctors(void) +__dtors(void) { - init_f *p = __CTOR_LIST__ + 1; + init_f *p = __DTOR_LIST__ + 1; while (*p) { (**p++)(); diff --git a/lib/csu/crtbegin.c b/lib/csu/crtbegin.c index 325b9d9f1d3..f594675d78d 100644 --- a/lib/csu/crtbegin.c +++ b/lib/csu/crtbegin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtbegin.c,v 1.15 2012/08/28 16:39:09 matthew Exp $ */ +/* $OpenBSD: crtbegin.c,v 1.16 2012/09/08 20:08:33 matthew Exp $ */ /* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */ /* @@ -95,25 +95,25 @@ static void __dtors(void) __used; static void __ctors(void) __used; static void -__dtors() +__ctors() { - unsigned long i = (unsigned long) __DTOR_LIST__[0]; + unsigned long i = (unsigned long) __CTOR_LIST__[0]; const init_f *p; if (i == -1) { - for (i = 1; __DTOR_LIST__[i] != NULL; i++) + for (i = 1; __CTOR_LIST__[i] != NULL; i++) ; i--; } - p = __DTOR_LIST__ + i; + p = __CTOR_LIST__ + i; while (i--) (**p--)(); } static void -__ctors() +__dtors() { - const init_f *p = __CTOR_LIST__ + 1; + const init_f *p = __DTOR_LIST__ + 1; while (*p) (**p++)(); diff --git a/lib/csu/crtbeginS.c b/lib/csu/crtbeginS.c index 1938f3e09c3..b72698fe2b4 100644 --- a/lib/csu/crtbeginS.c +++ b/lib/csu/crtbeginS.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtbeginS.c,v 1.12 2012/08/28 16:39:09 matthew Exp $ */ +/* $OpenBSD: crtbeginS.c,v 1.13 2012/09/08 20:08:33 matthew Exp $ */ /* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */ /* @@ -84,26 +84,26 @@ static void __dtors(void) __used; static void __ctors(void) __used; void -__dtors(void) +__ctors(void) { - unsigned long i = (unsigned long) __DTOR_LIST__[0]; + unsigned long i = (unsigned long) __CTOR_LIST__[0]; init_f *p; if (i == -1) { - for (i = 1; __DTOR_LIST__[i] != NULL; i++) + for (i = 1; __CTOR_LIST__[i] != NULL; i++) ; i--; } - p = __DTOR_LIST__ + i; + p = __CTOR_LIST__ + i; while (i--) { (**p--)(); } } static void -__ctors(void) +__dtors(void) { - init_f *p = __CTOR_LIST__ + 1; + init_f *p = __DTOR_LIST__ + 1; while (*p) { (**p++)(); |