Source-Changes-HG archive

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

[src/trunk]: src/lib/csu/common_elf Run the entries in __CTOR_LIST__ and __DT...



details:   https://anonhg.NetBSD.org/src/rev/6489c894dc92
branches:  trunk
changeset: 515977:6489c894dc92
user:      kristerw <kristerw%NetBSD.org@localhost>
date:      Thu Oct 11 18:02:28 2001 +0000

description:
Run the entries in __CTOR_LIST__ and __DTOR_LIST__ in the order gcc expect.

diffstat:

 lib/csu/common_elf/crtbegin.c |  28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diffs (49 lines):

diff -r 6f2b57c036a8 -r 6489c894dc92 lib/csu/common_elf/crtbegin.c
--- a/lib/csu/common_elf/crtbegin.c     Thu Oct 11 16:31:33 2001 +0000
+++ b/lib/csu/common_elf/crtbegin.c     Thu Oct 11 18:02:28 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crtbegin.c,v 1.13 2001/08/03 05:54:44 thorpej Exp $    */
+/*     $NetBSD: crtbegin.c,v 1.14 2001/10/11 18:02:28 kristerw Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -82,26 +82,26 @@
 static void
 __ctors()
 {
-       void (**p)(void) = __CTOR_LIST__ + 1;
+       unsigned long i = (unsigned long) __CTOR_LIST__[0];
+       void (**p)(void);
 
-       while (*p)
-               (**p++)();
+       if (i == -1)  {
+               for (i = 1; __CTOR_LIST__[i] != NULL; i++)
+                       ;
+               i--;
+       }
+       p = __CTOR_LIST__ + i;
+       while (i--)
+               (**p--)();
 }
 
 static void
 __dtors()
 {
-       unsigned long i = (unsigned long) __DTOR_LIST__[0];
-       void (**p)(void);
+       void (**p)(void) = __DTOR_LIST__ + 1;
 
-       if (i == -1)  {
-               for (i = 1; __DTOR_LIST__[i] != NULL; i++)
-                       ;
-               i--;
-       }
-       p = __DTOR_LIST__ + i;
-       while (i--)
-               (**p--)();
+       while (*p)
+               (**p++)();
 }
 
 void



Home | Main Index | Thread Index | Old Index