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
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 $@