Use wut 1.1.1

This commit is contained in:
Maschell 2022-08-08 11:28:31 +02:00
parent e027a8d4f8
commit d5c54fed78
4 changed files with 42 additions and 9 deletions

View File

@ -1,3 +1,3 @@
FROM wiiuenv/devkitppc:20220801
FROM wiiuenv/devkitppc:20220806
WORKDIR project

36
src/crt.c Normal file
View File

@ -0,0 +1,36 @@
void __init_wut_malloc();
void __init_wut_newlib();
void __init_wut_stdcpp();
void __init_wut_devoptab();
void __attribute__((weak)) __init_wut_socket();
void __fini_wut_malloc();
void __fini_wut_newlib();
void __fini_wut_stdcpp();
void __fini_wut_devoptab();
void __attribute__((weak)) __fini_wut_socket();
void __attribute__((weak))
init_wut() {
__init_wut_malloc();
__init_wut_newlib();
__init_wut_stdcpp();
__init_wut_devoptab();
if (&__init_wut_socket) __init_wut_socket();
}
void __attribute__((weak))
fini_wut() {
__fini_wut_devoptab();
__fini_wut_stdcpp();
__fini_wut_newlib();
__fini_wut_malloc();
}

View File

@ -59,7 +59,7 @@ IMPORT(OSCompareAndSwapAtomic);
IMPORT(OSGetThreadSpecific);
IMPORT(OSSetThreadSpecific);
IMPORT(FSTimeToCalendarTime);
IMPORT(OSIsDebuggerInitialized);
IMPORT(OSSwapAtomic);
IMPORT(exit);
IMPORT(_Exit);

View File

@ -64,19 +64,16 @@ bool CheckRunning() {
return true;
}
extern "C" void __init_wut();
extern "C" void __fini_wut();
extern "C" void __init_wut_malloc();
extern "C" void init_wut();
extern "C" void fini_wut();
extern "C" int _start(int argc, char **argv) __attribute__((section(".start_code")));
extern "C" int _start(int argc, char **argv) {
// We need to call __init_wut_malloc somewhere so wut_malloc will be used for the memory allocation.
__init_wut_malloc();
doKernelSetup();
InitFunctionPointers();
doKernelSetup2();
__init_wut();
init_wut();
// Save last entry on mem2 heap to detect leaked memory
MEMHeapHandle mem2_heap_handle = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2);
@ -105,7 +102,7 @@ extern "C" int _start(int argc, char **argv) {
OSReport("Freed %d leaked memory blocks\n", leak_count);
}
__fini_wut();
fini_wut();
if (entrypoint > 0) {
// clang-format off