Some little fixes (now gcc compiles empty file without errors)

This commit is contained in:
g1n 2021-08-02 20:48:07 +03:00
parent 8e5823ad96
commit 1766a07e16
2 changed files with 20 additions and 3 deletions

View File

@ -13,7 +13,7 @@ _start:
pushq %rdi
# Prepare signals, memory allocation, stdio and such.
call initialize_standard_library
# call initialize_standard_library
# Run the global constructors.
call _init
@ -23,9 +23,24 @@ _start:
popq %rsi
# Run main
call main
# call main
# Terminate the process with the exit code.
movl %eax, %edi
call exit
.size _start, . - _start
.global _init
_init:
push %rbp
movq %rsp, %rbp
.global _fini
_fini:
push %rbp
movq %rsp, %rbp
.global exit
exit:
call _fini
.size _start, . - _start

View File

@ -1,5 +1,6 @@
.section .init
.global _init
.type _init, @function
_init:
push %rbp
movq %rsp, %rbp
@ -7,6 +8,7 @@ _init:
.section .fini
.global _fini
.type _fini, @function
_fini:
push %rbp
movq %rsp, %rbp