Last active
July 22, 2021 08:15
-
-
Save dascandy/eb9ecd6a028d1a12c6bc7ce623c9e717 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt | |
| index d5852bbff..bb433d872 100644 | |
| --- a/Kernel/CMakeLists.txt | |
| +++ b/Kernel/CMakeLists.txt | |
| @@ -362,13 +362,13 @@ macro (set_new_alignment alignment) | |
| endmacro() | |
| if ("${SERENITY_ARCH}" STREQUAL "x86_64") | |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large -fno-pic -mno-red-zone") | |
| + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-pic -mno-red-zone") | |
| set_new_alignment(8) | |
| else() | |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fPIE") | |
| set_new_alignment(4) | |
| endif() | |
| + | |
| # Kernel Undefined Behavior Sanitizer (KUBSAN) | |
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") | |
| @@ -426,6 +426,14 @@ add_custom_target(generate_kernel_linker_script DEPENDS linker.ld) | |
| target_link_options(Kernel PRIVATE LINKER:-T ${CMAKE_CURRENT_BINARY_DIR}/linker.ld -nostdlib) | |
| set_target_properties(Kernel PROPERTIES LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/linker.ld") | |
| +if ("${SERENITY_ARCH}" STREQUAL "x86_64") | |
| + target_compile_options(kernel_heap PUBLIC -mcmodel=large) | |
| + target_compile_options(Kernel PRIVATE -mcmodel=large) | |
| +else() | |
| + target_compile_options(kernel_heap PUBLIC -pie -fPIE) | |
| + target_compile_options(Kernel PRIVATE -pie -fPIE) | |
| +endif() | |
| + | |
| if (ENABLE_KERNEL_LTO) | |
| include(CheckIPOSupported) | |
| check_ipo_supported() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment