|
|
|
@ -23,8 +23,15 @@ include("arch/${ARCH}/config/toolchain.cmake")
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffreestanding")
|
|
|
|
|
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -D_ASM_SOURCE")
|
|
|
|
|
if(DEBUG)
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ggdb")
|
|
|
|
|
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Og -ggdb")
|
|
|
|
|
# -Og on gcc optimizes for the best debugging experience, but apparently this
|
|
|
|
|
# is treated the same as -O1 on clang for some reason. The LLVM manual says
|
|
|
|
|
# you're supposed to use -O0 in order to get the most submissive and debuggable
|
|
|
|
|
# code instead:
|
|
|
|
|
# <https://clang.llvm.org/docs/CommandGuide/clang.html#code-generation-options>
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb")
|
|
|
|
|
# i don't think -O0 does anything for assembly code, but it can't hurt to
|
|
|
|
|
# have it in there just in case (somebody check on this at some point plz)
|
|
|
|
|
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -O0 -ggdb")
|
|
|
|
|
else()
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
|
|
|
|
endif()
|
|
|
|
|