Toolchain

This commit is contained in:
Alex
2022-12-08 07:45:56 +02:00
parent 096564b586
commit 397d4f9c5e
15 changed files with 25 additions and 206 deletions

View File

@ -1,8 +1,8 @@
# Config file
include ../../../Makefile.conf
CC = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc
AS = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)as
CC = ../../../$(TC_COMPILER_PATH)/$(TC_COMPILER_ARCH)gcc
AS = ../../../$(TC_COMPILER_PATH)/$(TC_COMPILER_ARCH)as
NASM = /usr/bin/nasm
C_SOURCES = $(shell find ./ -type f -name '*.c')
@ -16,8 +16,14 @@ else ifeq ($(OSARCH), i686)
ASM_ARCH := elf32
endif
CRTBEGIN_PATH = $(shell $(CC) -print-file-name=crtbegin.o)
CRTEND_PATH = $(shell $(CC) -print-file-name=crtend.o)
CRTI_PATH = $(shell $(CC) -print-file-name=crti.o)
CRTN_PATH = $(shell $(CC) -print-file-name=crtn.o)
build: $(OBJ)
mv $^ ../../out/system/lib/
cp $(CRTBEGIN_PATH) $(CRTEND_PATH) $(CRTI_PATH) $(CRTN_PATH) ../../out/system/lib/
%.o: %.c
$(CC) -nostdlib -mno-red-zone -std=c17 -c $< -o $@

View File

@ -1,14 +0,0 @@
# I WILL PLACE HERE THE crti.o BECAUSE GCC REFUSE TO LINK IT AND I DON'T KNOW WHY
.section .init
.global _init
.type _init, @function
_init:
push %rbp
movq %rsp, %rbp
.section .fini
.global _fini
.type _fini, @function
_fini:
push %rbp
movq %rsp, %rbp

View File

@ -1,8 +0,0 @@
# I WILL PLACE HERE THE crtn.o BECAUSE GCC REFUSE TO LINK IT AND I DON'T KNOW WHY
.section .init
popq %rbp
ret
.section .fini
popq %rbp
ret

View File

@ -1,13 +0,0 @@
.section .init
.global _init
.type _init, @function
_init:
push %rbp
movq %rsp, %rbp
.section .fini
.global _fini
.type _fini, @function
_fini:
push %rbp
movq %rsp, %rbp

View File

@ -1,7 +0,0 @@
.section .init
popq %rbp
ret
.section .fini
popq %rbp
ret