Use custom crt to skip socket_lib_finish call

This commit is contained in:
Maschell 2021-04-17 13:10:59 +02:00
parent 1a002e8472
commit 87e60dfe39
2 changed files with 34 additions and 4 deletions

30
source/crt.c Normal file
View File

@ -0,0 +1,30 @@
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

@ -1,7 +1,7 @@
.extern main
.extern exit
.extern __init_wut
.extern __fini_wut
.extern __init_wut_
.extern __fini_wut_
.global _start
_start:
@ -12,13 +12,13 @@ _start:
or 31, 1, 1
stw 3, 0x18(31)
stw 4, 0x1C(31)
bl __init_wut
bl __init_wut_
lwz 4, 0x1C(31)
lwz 3, 0x18(31)
bl main
or 9, 3, 3
stw 9, 0x8(31)
bl __fini_wut
bl __fini_wut_
lwz 9, 0x8(31)
or 3, 9, 9
addi 11, 31, 0x28