[libc] Pull crt0 out into its own module

Sorta. crt0 is a separate module as far as bonnibel is concerned, but it's
still part of the libc module file.
This commit is contained in:
Justin C. Miller
2024-02-13 22:41:40 -08:00
parent 75d30fb56d
commit ba6e8e1349
7 changed files with 28 additions and 4 deletions

View File

@@ -1,10 +1,18 @@
%include "util/got.inc"
extern _GLOBAL_OFFSET_TABLE_
extern main
extern exit
extern __init_libj6
extern __init_libc
; Put the address of the given symbol in rax
; This macro is the same as in util/got.inc,
; but crt0 can't have a dep on libutil
%macro lookup_GOT 1
lea rax, [rel _GLOBAL_OFFSET_TABLE_]
mov rax, [rax + %1 wrt ..got]
%endmacro
global _start:function weak (_libc_crt0_start.end - _libc_crt0_start)
global _libc_crt0_start:function (_libc_crt0_start.end - _libc_crt0_start)