From 1766a07e160fd3abd161b3b2ef3a288f3c516415 Mon Sep 17 00:00:00 2001 From: g1n Date: Mon, 2 Aug 2021 20:48:07 +0300 Subject: [PATCH] Some little fixes (now gcc compiles empty file without errors) --- x86_64/crt0.s | 21 ++++++++++++++++++--- x86_64/crti.s | 2 ++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/x86_64/crt0.s b/x86_64/crt0.s index bdc038e..b1fd47f 100644 --- a/x86_64/crt0.s +++ b/x86_64/crt0.s @@ -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 diff --git a/x86_64/crti.s b/x86_64/crti.s index 03ad2f9..032fd4a 100644 --- a/x86_64/crti.s +++ b/x86_64/crti.s @@ -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