Skip to content

Commit d6fecbc

Browse files
committed
Execute global constructors in correct order
LX106 compiler generates the constructor list in reverse order, as you can read at: https://github.com/jcmvbkbc/gcc-xtensa/blob/de95b6b65d806a648434e73a6db85f1e74d62ec8/gcc/varasm.c#L1391
1 parent 5313c56 commit d6fecbc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cores/esp8266/core_esp8266_main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ static void loop_task(os_event_t *events) {
119119
}
120120

121121
static void do_global_ctors(void) {
122-
void (**p)(void);
123-
for(p = &__init_array_start; p != &__init_array_end; ++p)
124-
(*p)();
122+
void (**p)(void) = &__init_array_end;
123+
while (p != &__init_array_start)
124+
(*--p)();
125125
}
126126

127127
extern "C" void __gdb_init() {}

0 commit comments

Comments
 (0)