mirror of
https://github.com/Fennix-Project/Userspace.git
synced 2025-05-28 15:34:26 +00:00
Update libc
This commit is contained in:
parent
ff61b602a5
commit
887f67e32d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
*.o
|
*.o
|
||||||
*.map
|
*.map
|
||||||
*.fex
|
*.fex
|
||||||
|
*.elf
|
||||||
out/
|
out/
|
@ -5,6 +5,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"debug.allowBreakpointsEverywhere": true
|
"debug.allowBreakpointsEverywhere": true,
|
||||||
|
"files.associations": {
|
||||||
|
"fex.hpp": "c"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
1
Makefile
1
Makefile
@ -1,6 +1,7 @@
|
|||||||
build:
|
build:
|
||||||
mkdir -p out
|
mkdir -p out
|
||||||
mkdir -p out/system
|
mkdir -p out/system
|
||||||
|
mkdir -p out/system/lib
|
||||||
make --quiet -C libc build
|
make --quiet -C libc build
|
||||||
make --quiet -C apps build
|
make --quiet -C apps build
|
||||||
|
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
build:
|
build:
|
||||||
|
make --quiet -C runtime build
|
||||||
|
make --quiet -C libgcc build
|
||||||
|
make --quiet -C src build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
make --quiet -C runtime clean
|
||||||
|
make --quiet -C libgcc clean
|
||||||
|
make --quiet -C src clean
|
||||||
|
0
libc/include/types.h
Normal file
0
libc/include/types.h
Normal file
44
libc/libgcc/Makefile
Normal file
44
libc/libgcc/Makefile
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# Config file
|
||||||
|
include ../../../Makefile.conf
|
||||||
|
|
||||||
|
NAME=gcc
|
||||||
|
|
||||||
|
OBJECT_NAME=lib$(NAME).a
|
||||||
|
|
||||||
|
OUTPUT_DIR=../../out/system/lib/
|
||||||
|
|
||||||
|
CC = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc
|
||||||
|
AR = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)ar
|
||||||
|
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}
|
||||||
|
|
||||||
|
INCLUDE_DIR = ../include
|
||||||
|
|
||||||
|
ifeq ($(OSARCH), amd64)
|
||||||
|
ASM_ARCH := elf64
|
||||||
|
else ifeq ($(OSARCH), i686)
|
||||||
|
ASM_ARCH := elf32
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS := -fPIC -I$(INCLUDE_DIR)
|
||||||
|
|
||||||
|
build: $(OBJECT_NAME)
|
||||||
|
|
||||||
|
$(OBJECT_NAME): $(OBJ)
|
||||||
|
$(AR) rcs $(OUTPUT_DIR)$@ $(OBJ)
|
||||||
|
|
||||||
|
%.o: %.c $(HEADERS) $(HEADERS2)
|
||||||
|
$(CC) $(CFLAGS) -std=c17 -c $< -o $@
|
||||||
|
|
||||||
|
%.o: %.cpp $(HEADERS) $(HEADERS2)
|
||||||
|
$(CC) $(CFLAGS) -std=c++20 -c $< -o $@
|
||||||
|
|
||||||
|
%.o: %.asm
|
||||||
|
$(NASM) $< -f $(ASM_ARCH) -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
|
0
libc/libgcc/cxa.cpp
Normal file
0
libc/libgcc/cxa.cpp
Normal file
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
|
44
libc/src/Makefile
Normal file
44
libc/src/Makefile
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# Config file
|
||||||
|
include ../../../Makefile.conf
|
||||||
|
|
||||||
|
NAME=c
|
||||||
|
|
||||||
|
OBJECT_NAME=lib$(NAME).a
|
||||||
|
|
||||||
|
OUTPUT_DIR=../../out/system/lib/
|
||||||
|
|
||||||
|
CC = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc
|
||||||
|
AR = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)ar
|
||||||
|
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}
|
||||||
|
|
||||||
|
INCLUDE_DIR = ../include
|
||||||
|
|
||||||
|
ifeq ($(OSARCH), amd64)
|
||||||
|
ASM_ARCH := elf64
|
||||||
|
else ifeq ($(OSARCH), i686)
|
||||||
|
ASM_ARCH := elf32
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS := -fPIC -I$(INCLUDE_DIR)
|
||||||
|
|
||||||
|
build: $(OBJECT_NAME)
|
||||||
|
|
||||||
|
$(OBJECT_NAME): $(OBJ)
|
||||||
|
$(AR) rcs $(OUTPUT_DIR)$@ $(OBJ)
|
||||||
|
|
||||||
|
%.o: %.c $(HEADERS) $(HEADERS2)
|
||||||
|
$(CC) $(CFLAGS) -std=c17 -c $< -o $@
|
||||||
|
|
||||||
|
%.o: %.cpp $(HEADERS) $(HEADERS2)
|
||||||
|
$(CC) $(CFLAGS) -std=c++20 -c $< -o $@
|
||||||
|
|
||||||
|
%.o: %.asm
|
||||||
|
$(NASM) $< -f $(ASM_ARCH) -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJ)
|
0
libc/src/main.c
Normal file
0
libc/src/main.c
Normal file
Loading…
x
Reference in New Issue
Block a user