kernel: Build with optimizations only in debug mode

This commit is contained in:
apio 2023-03-24 21:25:26 +01:00
parent 36e48b2ad2
commit 8b712b04c2
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -74,8 +74,6 @@ target_link_libraries(moon luna-freestanding)
target_compile_definitions(moon PRIVATE IN_MOON) target_compile_definitions(moon PRIVATE IN_MOON)
target_compile_options(moon PRIVATE -Os)
target_compile_options(moon PRIVATE -Wall -Wextra -Werror -Wvla -Wsign-conversion) target_compile_options(moon PRIVATE -Wall -Wextra -Werror -Wvla -Wsign-conversion)
target_compile_options(moon PRIVATE -Wdisabled-optimization -Wformat=2 -Winit-self) target_compile_options(moon PRIVATE -Wdisabled-optimization -Wformat=2 -Winit-self)
target_compile_options(moon PRIVATE -Wmissing-include-dirs -Wswitch-default -Wcast-qual -Wundef) target_compile_options(moon PRIVATE -Wmissing-include-dirs -Wswitch-default -Wcast-qual -Wundef)
@ -94,6 +92,8 @@ if(MOON_DEBUG_SYMBOLS)
message(STATUS "Building Moon with debug symbols") message(STATUS "Building Moon with debug symbols")
target_compile_options(moon PRIVATE -ggdb) target_compile_options(moon PRIVATE -ggdb)
include(debug.cmake) include(debug.cmake)
else()
target_compile_options(moon PRIVATE -Os)
endif() endif()
target_link_options(moon PRIVATE -lgcc -Wl,--build-id=none -z max-page-size=0x1000 -mcmodel=kernel) target_link_options(moon PRIVATE -lgcc -Wl,--build-id=none -z max-page-size=0x1000 -mcmodel=kernel)