Skip to content

Commit

Permalink
Execute global constructors in correct order (esp8266#2074)
Browse files Browse the repository at this point in the history
Walk .ctors array from back to front, like gcc's gbl-ctors.h does
  • Loading branch information
unaiur authored and igrr committed Jun 1, 2016
1 parent 8176cbb commit 1dd50fb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cores/esp8266/core_esp8266_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ static void loop_task(os_event_t *events) {
}

static void do_global_ctors(void) {
void (**p)(void);
for(p = &__init_array_start; p != &__init_array_end; ++p)
(*p)();
void (**p)(void) = &__init_array_end;
while (p != &__init_array_start)
(*--p)();
}

extern "C" void __gdb_init() {}
Expand Down

0 comments on commit 1dd50fb

Please sign in to comment.