libc: Add dummy argv

This commit is contained in:
apio 2022-10-21 18:33:06 +02:00
parent 6d7a8a0d0b
commit 62fa773b27
2 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,8 @@ extern _fini
extern initialize_libc extern initialize_libc
extern exit extern exit
extern __argv
global _start global _start
_start: _start:
; Set up end of the stack frame linked list. ; Set up end of the stack frame linked list.
@ -19,7 +21,7 @@ _start:
call _init call _init
mov rdi, 0 ; argc = 0 mov rdi, 0 ; argc = 0
mov rsi, 0 ; argv = 0 mov rsi, __argv ; Dummy argv which is equal to {NULL}
call main call main

View File

@ -4,6 +4,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
__attribute__((used)) const char* __argv[] = {NULL}; // For now.
static void terminate_libc() static void terminate_libc()
{ {
fclose(stdout); fclose(stdout);