From f27eb315fc65bd1ab37d1552dc0407d79e4ce833 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 24 Feb 2021 11:30:19 +0100 Subject: [PATCH] Build: Build Userland with -O2, Kernel with -Os For some reason I don't yet understand, building the kernel with -O2 produces a way-too-large kernel on some people's systems. Since there are some really nice performance benefits from -O2 in userspace, let's do a compromise and build Userland with -O2 but put Kernel back into the -Os box for now. --- CMakeLists.txt | 2 +- Kernel/CMakeLists.txt | 2 ++ Userland/CMakeLists.txt | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23c3837d39..89a9b5115f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,7 +153,7 @@ set(CMAKE_CXX_LINK_FLAGS "-Wl,--hash-style=gnu,-z,relro,-z,now") # This will need to be revisited when the Loader supports RPATH/RUN_PATH. set(CMAKE_SKIP_RPATH TRUE) -add_compile_options(-O2 -g1 -fno-exceptions -fstack-protector-strong -Wno-address-of-packed-member -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-nonnull-compare -Wno-deprecated-copy -Wno-expansion-to-defined) +add_compile_options(-g1 -fno-exceptions -fstack-protector-strong -Wno-address-of-packed-member -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-nonnull-compare -Wno-deprecated-copy -Wno-expansion-to-defined) add_compile_options(-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 7481682596..1096416806 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -1,3 +1,5 @@ +add_compile_options(-Os) + set(KERNEL_HEAP_SOURCES Heap/SlabAllocator.cpp Heap/kmalloc.cpp diff --git a/Userland/CMakeLists.txt b/Userland/CMakeLists.txt index af91921beb..27851b31d0 100644 --- a/Userland/CMakeLists.txt +++ b/Userland/CMakeLists.txt @@ -1,3 +1,5 @@ +add_compile_options(-O2) + add_subdirectory(Applications) add_subdirectory(Demos) add_subdirectory(DevTools)