]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
eabi-ctors.c (__do_global_ctors): Run through __CTOR_LIST__ in opposite order...
authorJeffrey A Law <law@cygnus.com>
Wed, 8 Mar 2000 05:05:06 +0000 (05:05 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 8 Mar 2000 05:05:06 +0000 (22:05 -0700)
        Tue Oct 12 09:45:19 1999  Jonathan Larmour  <jlarmour@cygnus.co.uk>
        * config/rs6000/eabi-ctors.c (__do_global_ctors): Run through
        __CTOR_LIST__ in opposite order, which is the correct order for sorted
        constructors.
        (__do_global_dtors): similarly for __DTOR_LIST__.

From-SVN: r32406

gcc/ChangeLog
gcc/config/rs6000/eabi-ctors.c

index 448a0c146f82e16620ae9a3805c19bc8c6420a40..6bf7f288ae45743cf437d667d318b9ea21907c8e 100644 (file)
@@ -1,5 +1,11 @@
 Tue Mar  7 21:41:17 2000  Jeffrey A Law  (law@cygnus.com)
 
+       Tue Oct 12 09:45:19 1999  Jonathan Larmour  <jlarmour@cygnus.co.uk>
+       * config/rs6000/eabi-ctors.c (__do_global_ctors): Run through
+       __CTOR_LIST__ in opposite order, which is the correct order for sorted
+       constructors.
+       (__do_global_dtors): similarly for __DTOR_LIST__.
+
        2000-01-05  Bernd Schmidt  <bernds@cygnus.co.uk>
        * reload1.c (choose_reload_regs): When disabling a reload, also
        set reload_spill_index to -1.
index ebc23ded35cec0a961283d546f952f08baba0a16..2ff3c1abc61bcc2a1947d34e2fd437513de07ba2 100644 (file)
@@ -58,14 +58,14 @@ void (*__atexit)(func_ptr);
 void
 __do_global_ctors (void)
 {
-  func_ptr *ptr = &__CTOR_LIST__[0];
-  func_ptr *end = &__CTOR_END__[0];
+  func_ptr *ptr   = &__CTOR_END__[0] - 1;
+  func_ptr *start = &__CTOR_LIST__[0];
 
   if (__atexit)
     __atexit (__do_global_dtors);
 
   /* Call the constructors collected in the .ctors section.  */
-  for ( ; ptr != end; ptr++)
+  for ( ; ptr >= start; ptr--)
     if (*ptr)
       (*ptr)();
 
@@ -77,15 +77,15 @@ __do_global_ctors (void)
 void
 __do_global_dtors (void)
 {
-  func_ptr *ptr   = &__DTOR_END__[0] - 1;
-  func_ptr *start = &__DTOR_LIST__[0];
+  func_ptr *ptr   = &__DTOR_LIST__[0];
+  func_ptr *end   = &__DTOR_END__[0];
 
   /* Call the termination function in the .fini section.  */
   (*fini_ptr) ();
 
   /* Call the  destructors collected in the .dtors section.  Run
      the destructors in reverse order.  */
-  for ( ; ptr >= start; ptr--)
+  for ( ; ptr < end; ptr++)
     if (*ptr)
       (*ptr)();
 }