For some reason this makes exception handling work again.
ASFLAGS_BASE = -f elf -g dwarf2
CFLAGS_BASE = -fgnu89-inline -ffreestanding -nostdlib -Iinclude \
-Iinclude/arch/x86 -g -DGIT_COMMIT=\"$(GIT_REV)\" \
- -Og
-LDFLAGS_BASE = -ffreestanding -nostdlib -lgcc -g -T arch/x86/linker.ld
+ -O2 -flto
+LDFLAGS_BASE = -ffreestanding -nostdlib -lgcc -g -O2 -flto -T arch/x86/linker.ld
kernel.elf kernel.dbg: $(KERNEL_OBJ)
$(REAL_CC) $(LDFLAGS_BASE) $(LDFLAGS) $^ -o $@