From: Jeffrey A Law Date: Wed, 8 Mar 2000 05:05:06 +0000 (+0000) Subject: eabi-ctors.c (__do_global_ctors): Run through __CTOR_LIST__ in opposite order... X-Git-Tag: prereleases/gcc-2.95.3-test1~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=410b165d40bf8d1b41498871f7a66c9d88d2c455;p=thirdparty%2Fgcc.git eabi-ctors.c (__do_global_ctors): Run through __CTOR_LIST__ in opposite order... Tue Oct 12 09:45:19 1999 Jonathan Larmour * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 448a0c146f82..6bf7f288ae45 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 + * 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 * reload1.c (choose_reload_regs): When disabling a reload, also set reload_spill_index to -1. diff --git a/gcc/config/rs6000/eabi-ctors.c b/gcc/config/rs6000/eabi-ctors.c index ebc23ded35ce..2ff3c1abc61b 100644 --- a/gcc/config/rs6000/eabi-ctors.c +++ b/gcc/config/rs6000/eabi-ctors.c @@ -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)(); }