mirror of
https://github.com/Fennix-Project/Userspace.git
synced 2025-07-10 22:59:22 +00:00
Update libc
This commit is contained in:
31
libc/runtime/Makefile
Normal file
31
libc/runtime/Makefile
Normal file
@ -0,0 +1,31 @@
|
||||
# Config file
|
||||
include ../../../Makefile.conf
|
||||
|
||||
CC = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc
|
||||
NASM = /usr/bin/nasm
|
||||
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.s')
|
||||
ASM_SOURCES = $(shell find ./ -type f -name '*.asm')
|
||||
OBJ = ${C_SOURCES:.c=.o} ${ASM_SOURCES:.asm=.o} ${S_SOURCES:.s=.o}
|
||||
|
||||
ifeq ($(OSARCH), amd64)
|
||||
ASM_ARCH := elf64
|
||||
else ifeq ($(OSARCH), i686)
|
||||
ASM_ARCH := elf32
|
||||
endif
|
||||
|
||||
build: $(OBJ)
|
||||
mv $^ ../../out/system/lib/
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -nostdlib -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.asm
|
||||
$(NASM) $< -f $(ASM_ARCH) -o $@
|
||||
|
||||
%.bin: %.s
|
||||
$(NASM) $< -f $(ASM_ARCH) -o $@
|
||||
|
||||
clean:
|
||||
|
10
libc/runtime/crt0.c
Normal file
10
libc/runtime/crt0.c
Normal file
@ -0,0 +1,10 @@
|
||||
int main(int argc, char *argv[], char *envp[]);
|
||||
|
||||
int _start(void *Data)
|
||||
{
|
||||
int mainret = main((int)0, (char **)0, (char **)0);
|
||||
while (1)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
// C stuff
|
10
libc/runtime/crt1.c
Normal file
10
libc/runtime/crt1.c
Normal file
@ -0,0 +1,10 @@
|
||||
int main(int argc, char *argv[], char *envp[]);
|
||||
|
||||
int _start(void *Data)
|
||||
{
|
||||
int mainret = main((int)0, (char **)0, (char **)0);
|
||||
while (1)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
// C++ stuff
|
1
libc/runtime/crtbegin.c
Normal file
1
libc/runtime/crtbegin.c
Normal file
@ -0,0 +1 @@
|
||||
// C++ constructor/destructor stuff
|
1
libc/runtime/crtend.c
Normal file
1
libc/runtime/crtend.c
Normal file
@ -0,0 +1 @@
|
||||
// C++ constructor/destructor stuff
|
Reference in New Issue
Block a user