From 99a030764f8e82f362926b77d01e10711774fb32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Duje=20Mihanovi=C4=87?= Date: Wed, 29 Jun 2022 10:49:01 +0200 Subject: [PATCH] kernel, stage3: Enable -O2 and LTO by default --- boot/x86/stage3/Makefile | 5 +++-- kernel/Makefile | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/boot/x86/stage3/Makefile b/boot/x86/stage3/Makefile index c9622b2..81a4290 100644 --- a/boot/x86/stage3/Makefile +++ b/boot/x86/stage3/Makefile @@ -1,8 +1,9 @@ STAGE3_OBJ = loader.o elf.o paging.o prekernel.o ASFLAGS_BASE = -f elf -g dwarf2 -DGIT_REVISION=\"$(GIT_REV)\" -CFLAGS_BASE = -ffreestanding -nostdlib -DGIT_REVISION=\"$(GIT_REV)\" -g -LDFLAGS_BASE = -ffreestanding -nostdlib -g -lgcc -T stage3.ld +CFLAGS_BASE = -ffreestanding -nostdlib -DGIT_REVISION=\"$(GIT_REV)\" -g \ + -O2 -flto +LDFLAGS_BASE = -ffreestanding -nostdlib -g -lgcc -T stage3.ld -flto default: LOADER.BIN loader.elf diff --git a/kernel/Makefile b/kernel/Makefile index a872ca6..8c9b27b 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -4,8 +4,10 @@ include drivers/Makefile include arch/x86/Makefile ASFLAGS_BASE = -f elf -g dwarf2 -CFLAGS_BASE = -fgnu89-inline -ffreestanding -nostdlib -Iinclude -Iinclude/arch/x86 -g -DGIT_COMMIT=\"$(GIT_REV)\" -LDFLAGS_BASE = -ffreestanding -nostdlib -lgcc -g +CFLAGS_BASE = -fgnu89-inline -ffreestanding -nostdlib -Iinclude \ + -Iinclude/arch/x86 -g -DGIT_COMMIT=\"$(GIT_REV)\" \ + -O2 -flto +LDFLAGS_BASE = -ffreestanding -nostdlib -lgcc -g -flto kernel.elf kernel.dbg: $(KERNEL_OBJ) $(CC) $(LDFLAGS_BASE) $(LDFLAGS) -T linker.ld $^ -o $@ -- 2.39.2