diff options
author | Jonathan Larmour <jlarmour@cygnus.co.uk> | 1999-10-12 16:47:08 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1999-10-12 12:47:08 -0400 |
commit | ac1389b7050927d75c705988defb8872181528b2 (patch) | |
tree | 91faea235360e2d37cf61f45fcfce9c9692f6bed /gcc/config/rs6000 | |
parent | 9ffe22f9f2f8619013775f75fbaf1db3a4dc7c70 (diff) | |
download | gcc-ac1389b7050927d75c705988defb8872181528b2.zip gcc-ac1389b7050927d75c705988defb8872181528b2.tar.gz gcc-ac1389b7050927d75c705988defb8872181528b2.tar.bz2 |
eabi-ctors.c (__do_global_ctors): Run through __CTOR_LIST__ in opposite order...
* 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: r29925
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r-- | gcc/config/rs6000/eabi-ctors.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/config/rs6000/eabi-ctors.c b/gcc/config/rs6000/eabi-ctors.c index ebc23de..2ff3c1a 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)(); } |