Merge pull request #5851 from QuarkTheAwesome/wiiu-toolchain-patch1

[WiiU] Toolchain: Actually fix C++ constructors/destructors (oops!)
This commit is contained in:
Twinaphex 2017-12-03 03:14:47 +01:00 committed by GitHub
commit 8082dfe56c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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