Use LLVM linker, Dockerfile now works without GCC
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m16s

This commit is contained in:
2026-03-07 10:41:35 +01:00
parent bc5b04d809
commit 955dbc7614
7 changed files with 19 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
FROM ubuntu:latest AS builder
RUN apt-get update && apt-get -y install clang llvm lld make xorriso gcc
RUN apt-get update && apt-get -y install clang llvm lld make xorriso
WORKDIR /usr/src/MOP3

View File

@@ -1,4 +1,4 @@
cflags += --target=x86_64-pc-none-elf \
cflags += --target=x86_64-unknown-unknown-elf \
-mno-sse \
-mno-sse2 \
-mno-avx \
@@ -7,5 +7,4 @@ cflags += --target=x86_64-pc-none-elf \
-mno-red-zone \
-mcmodel=large
ldflags += --target=x86_64-pc-none-elf \
-Wl,-zmax-page-size=0x1000
ldflags += -zmax-page-size=0x1000

View File

@@ -17,18 +17,11 @@ endif
cflags += -isystem ../include
ldflags += -ffreestanding \
-nostdlib \
-fno-builtin \
-fuse-ld=lld \
-static
ifeq ($(buildtype),debug)
ldflags += -g
endif
ldflags += --nostdlib \
--static
ifeq ($(buildtype),release)
ldflags += -Wl,--gc-sections \
-Wl,--strip-all \
-flto
ldflags += --gc-sections \
--strip-all \
-O3
endif

View File

@@ -1,4 +1,5 @@
cc := clang
ld := ld.lld
o :=
c :=
ldflags :=
@@ -12,7 +13,7 @@ include make/src.mk
all: build/kernel.elf
build/kernel.elf: $(o)
$(cc) -o $@ $(ldflags) -T $(platform)/link.ld $^
$(ld) -o $@ $(ldflags) -T $(platform)/link.ld $^
%.o: %.c
$(cc) -c -o $@ $(cflags) $<

View File

@@ -1,4 +1,4 @@
cflags += --target=x86_64-pc-none-elf \
cflags += --target=x86_64-unknown-unknown-elf \
-mno-sse \
-mno-sse2 \
-mno-avx \
@@ -7,5 +7,4 @@ cflags += --target=x86_64-pc-none-elf \
-mno-red-zone \
-fno-omit-frame-pointer
ldflags += --target=x86_64-pc-none-elf \
-Wl,-zmax-page-size=0x1000
ldflags += -zmax-page-size=0x1000

View File

@@ -23,18 +23,11 @@ ifeq ($(buildtype),release)
cflags += -ffunction-sections -fdata-sections -Oz
endif
ldflags += -ffreestanding \
-nostdlib \
-fno-builtin \
-fuse-ld=lld \
-static
ifeq ($(buildtype),debug)
ldflags += -g
endif
ldflags += --nostdlib \
--static
ifeq ($(buildtype),release)
ldflags += -Wl,--gc-sections \
-Wl,--strip-all \
-flto
ldflags += --gc-sections \
--strip-all \
-O3
endif

View File

@@ -1,4 +1,5 @@
cc := clang
ld := ld.lld
o :=
c :=
ldflags += -L ../libsystem/build -l:libsystem.a -L ../liballoc/build -l:liballoc.a
@@ -12,7 +13,7 @@ include ../$(platform)/flags.mk
all: $(app)
$(app): $(o)
$(cc) -o $@ $(ldflags) -T ../$(platform)/link.ld $^
$(ld) -o $@ $(ldflags) -T ../$(platform)/link.ld $^
%.o: %.c
$(cc) -c -o $@ $(cflags) $<