Use LLVM linker, Dockerfile now works without GCC
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m16s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m16s
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
FROM ubuntu:latest AS builder
|
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
|
WORKDIR /usr/src/MOP3
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cflags += --target=x86_64-pc-none-elf \
|
cflags += --target=x86_64-unknown-unknown-elf \
|
||||||
-mno-sse \
|
-mno-sse \
|
||||||
-mno-sse2 \
|
-mno-sse2 \
|
||||||
-mno-avx \
|
-mno-avx \
|
||||||
@@ -7,5 +7,4 @@ cflags += --target=x86_64-pc-none-elf \
|
|||||||
-mno-red-zone \
|
-mno-red-zone \
|
||||||
-mcmodel=large
|
-mcmodel=large
|
||||||
|
|
||||||
ldflags += --target=x86_64-pc-none-elf \
|
ldflags += -zmax-page-size=0x1000
|
||||||
-Wl,-zmax-page-size=0x1000
|
|
||||||
|
|||||||
@@ -17,18 +17,11 @@ endif
|
|||||||
|
|
||||||
cflags += -isystem ../include
|
cflags += -isystem ../include
|
||||||
|
|
||||||
ldflags += -ffreestanding \
|
ldflags += --nostdlib \
|
||||||
-nostdlib \
|
--static
|
||||||
-fno-builtin \
|
|
||||||
-fuse-ld=lld \
|
|
||||||
-static
|
|
||||||
|
|
||||||
ifeq ($(buildtype),debug)
|
|
||||||
ldflags += -g
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(buildtype),release)
|
ifeq ($(buildtype),release)
|
||||||
ldflags += -Wl,--gc-sections \
|
ldflags += --gc-sections \
|
||||||
-Wl,--strip-all \
|
--strip-all \
|
||||||
-flto
|
-O3
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
cc := clang
|
cc := clang
|
||||||
|
ld := ld.lld
|
||||||
o :=
|
o :=
|
||||||
c :=
|
c :=
|
||||||
ldflags :=
|
ldflags :=
|
||||||
@@ -12,7 +13,7 @@ include make/src.mk
|
|||||||
all: build/kernel.elf
|
all: build/kernel.elf
|
||||||
|
|
||||||
build/kernel.elf: $(o)
|
build/kernel.elf: $(o)
|
||||||
$(cc) -o $@ $(ldflags) -T $(platform)/link.ld $^
|
$(ld) -o $@ $(ldflags) -T $(platform)/link.ld $^
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(cc) -c -o $@ $(cflags) $<
|
$(cc) -c -o $@ $(cflags) $<
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cflags += --target=x86_64-pc-none-elf \
|
cflags += --target=x86_64-unknown-unknown-elf \
|
||||||
-mno-sse \
|
-mno-sse \
|
||||||
-mno-sse2 \
|
-mno-sse2 \
|
||||||
-mno-avx \
|
-mno-avx \
|
||||||
@@ -7,5 +7,4 @@ cflags += --target=x86_64-pc-none-elf \
|
|||||||
-mno-red-zone \
|
-mno-red-zone \
|
||||||
-fno-omit-frame-pointer
|
-fno-omit-frame-pointer
|
||||||
|
|
||||||
ldflags += --target=x86_64-pc-none-elf \
|
ldflags += -zmax-page-size=0x1000
|
||||||
-Wl,-zmax-page-size=0x1000
|
|
||||||
|
|||||||
@@ -23,18 +23,11 @@ ifeq ($(buildtype),release)
|
|||||||
cflags += -ffunction-sections -fdata-sections -Oz
|
cflags += -ffunction-sections -fdata-sections -Oz
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ldflags += -ffreestanding \
|
ldflags += --nostdlib \
|
||||||
-nostdlib \
|
--static
|
||||||
-fno-builtin \
|
|
||||||
-fuse-ld=lld \
|
|
||||||
-static
|
|
||||||
|
|
||||||
ifeq ($(buildtype),debug)
|
|
||||||
ldflags += -g
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(buildtype),release)
|
ifeq ($(buildtype),release)
|
||||||
ldflags += -Wl,--gc-sections \
|
ldflags += --gc-sections \
|
||||||
-Wl,--strip-all \
|
--strip-all \
|
||||||
-flto
|
-O3
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
cc := clang
|
cc := clang
|
||||||
|
ld := ld.lld
|
||||||
o :=
|
o :=
|
||||||
c :=
|
c :=
|
||||||
ldflags += -L ../libsystem/build -l:libsystem.a -L ../liballoc/build -l:liballoc.a
|
ldflags += -L ../libsystem/build -l:libsystem.a -L ../liballoc/build -l:liballoc.a
|
||||||
@@ -12,7 +13,7 @@ include ../$(platform)/flags.mk
|
|||||||
all: $(app)
|
all: $(app)
|
||||||
|
|
||||||
$(app): $(o)
|
$(app): $(o)
|
||||||
$(cc) -o $@ $(ldflags) -T ../$(platform)/link.ld $^
|
$(ld) -o $@ $(ldflags) -T ../$(platform)/link.ld $^
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(cc) -c -o $@ $(cflags) $<
|
$(cc) -c -o $@ $(cflags) $<
|
||||||
|
|||||||
Reference in New Issue
Block a user