Lots of work on the build system

This commit is contained in:
Max Wash
2020-03-31 16:21:07 +01:00
parent 28256512c9
commit 76d1753ab5
11 changed files with 130 additions and 12 deletions

View File

@@ -48,6 +48,4 @@ typedef __uintmax_t uintmax_t;
typedef __intptr_t intptr_t;
typedef __uintptr_t uintptr_t;
typedef
#endif /* STDINT_H_ */

View File

@@ -0,0 +1,30 @@
#ifndef STDIO_H_
#define STDIO_H_
#include <sys/_fconst.h>
#if defined(__FILENAME_MAX)
#define FILENAME_MAX __FILENAME_MAX
#else
#define FILENAME_MAX 1024
#endif
#define SEEK_SET __SEEK_SET
#define SEEK_CUR __SEEK_CUR
#define SEEK_END __SEEK_END
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct __io_file FILE;
extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;
#if defined(__cplusplus)
}
#endif
#endif

View File

@@ -0,0 +1,20 @@
#ifndef SYS_LINUX___FIO_H_
#define SYS_LINUX___FIO_H_
#define __FIO_BUFSZ 512
#if defined(__cplusplus)
extern "C" {
#endif
struct __io_file {
char buf[__FIO_BUFSZ];
unsigned int buf_idx;
unsigned int fd;
};
#if defined(__cplusplus)
}
#endif
#endif

View File

@@ -0,0 +1,10 @@
#ifndef SYS_LINUX__FCONST_H_
#define SYS_LINUX__FCONST_H_
#define __FILENAME_MAX 1024
#define __SEEK_SET 0
#define __SEEK_CUR 1
#define __SEEK_END 2
#endif

View File

@@ -0,0 +1,16 @@
#include "__fio.h"
struct __io_file __stdin = {};
struct __io_file __stdout = {};
struct __io_file __stderr = {};
struct __io_file *stdin = &__stdin;
struct __io_file *stdout = &__stdout;
struct __io_file *stderr = &__stderr;
void __fio_init()
{
__stdin.fd = 0;
__stdout.fd = 1;
__stderr.fd = 2;
}

View File

@@ -1,6 +1,9 @@
.global _start
.type _start, @function
.extern __fio_init
.type __fio_init, @function
.extern main
.type main, @function
@@ -9,6 +12,7 @@ _start:
pop %rdi
mov %rsp, %rsi
andq $-16, %rsp
call __fio_init
call main
movq %rax, %rdi
movq $60, %rax