Skip to content

Commit

Permalink
Build: add optimization flags.
Browse files Browse the repository at this point in the history
Compile with the standard -O2 optimization flag and enable Link Time
Optimizations. Fix a uninitialized variable in RawLinkedList implementation.

Testing done: make kernel
qemu -kernel out/kernel/Kernel/Kernel.bin -m 512
  • Loading branch information
ddejean committed Feb 20, 2014
1 parent c24e436 commit 36b78cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion build/config.mk
Expand Up @@ -24,13 +24,17 @@ BUILD_TEST := $(BUILD_ROOT)/build-tests.mk
BUILD_EXECUTABLE := $(BUILD_ROOT)/build-executable.mk

# Default build flags
DEFAULT_FLAGS := -m32 -Wall -Wextra -Werror -g -gstabs -pipe
DEFAULT_FLAGS := -m32 -Wall -Wextra -Werror -g -gstabs -pipe -O2
DEFAULT_CFLAGS := $(DEFAULT_FLAGS) -std=c99
DEFAULT_CPPFLAGS := $(DEFAULT_FLAGS)
DEFAULT_ASFLAGS := $(DEFAULT_FLAGS)
DEFAULT_LDFLAGS := -melf_i386
DEFAULT_ARFLAGS := rcs

# Link Time Optimization
DEFAULT_FLAGS += -flto -flto-compression-level=9 -fuse-linker-plugin
DEFAULT_LDFLAGS += -flto

# Kernel build flags
KERNEL_INCLUDES := kernel/ kernel/CUtils/
KERNEL_CFLAGS := -nostdinc -fno-stack-protector
Expand Down
8 changes: 4 additions & 4 deletions kernel/Utils/RawLinkedList.h
Expand Up @@ -176,11 +176,11 @@ void RawLinkedList<T>::removeAt(unsigned i)
assert(pos == i-1);
d = n->next;
n->next = d->next;
}

/* Handle the last element case */
if (mLast == d) {
mLast = n;
/* Handle the last element case */
if (mLast == d) {
mLast = n;
}
}

/* Handle when the list is empty */
Expand Down

0 comments on commit 36b78cf

Please sign in to comment.