[libc] Call global ctors in user code

This change adds a new __init_libc function which calls all the global
ctors in .init_array, and is called from _start.
This commit is contained in:
Justin C. Miller
2022-02-12 13:55:07 -08:00
parent ba610864c7
commit d20c77c618
3 changed files with 31 additions and 0 deletions

View File

@@ -1,12 +1,14 @@
extern main
extern exit
extern __init_libj6
extern __init_libc
global _start:function (_start.end - _start)
_start:
mov rbp, rsp
mov rdi, rsp
call __init_libj6
call __init_libc
pop rdi
mov rsi, rsp