[WiiU] Toolchain: Actually fix C++ constructors/destructors (oops!)

Looks like I temporarily forgot how external symbols work. Fixes
https://gbatemp.net/posts/7720955; hopefully we finally have C++ under
control.
This commit is contained in:
Ash 2017-12-03 11:31:30 +11:00
parent 4efc8453c2
commit e9a3088a79
No known key found for this signature in database
GPG Key ID: F8C85A8C836C0A7E

View File

@ -525,24 +525,23 @@ void __eabi()
__attribute__((weak))
void __init(void)
{
extern void (**const __CTOR_LIST__)(void);
extern void (**const __CTOR_END__)(void);
extern void (*const __CTOR_LIST__)(void);
extern void (*const __CTOR_END__)(void);
void (**ctor)(void) = __CTOR_LIST__;
while (ctor < __CTOR_END__) {
void (*const *ctor)(void) = &__CTOR_LIST__;
while (ctor < &__CTOR_END__) {
(*ctor++)();
}
}
__attribute__((weak))
void __fini(void)
{
extern void (**const __DTOR_LIST__)(void);
extern void (**const __DTOR_END__)(void);
extern void (*const __DTOR_LIST__)(void);
extern void (*const __DTOR_END__)(void);
void (**dtor)(void) = __DTOR_LIST__;
while (dtor < __DTOR_END__) {
void (*const *dtor)(void) = &__DTOR_LIST__;
while (dtor < &__DTOR_END__) {
(*dtor++)();
}
}
@ -654,7 +653,10 @@ void _start(int argc, char **argv)
main(argc, argv);
fsdev_exit();
// __fini();
/* TODO: fix elf2rpl so it doesn't error with "Could not find matching symbol
for relocation" then uncomment this */
// __fini();
memoryRelease();
SYSRelaunchTitle(0, 0);
exit(0);