Skip to content

Instantly share code, notes, and snippets.

@dascandy
Created July 22, 2021 22:46
Show Gist options
  • Select an option

  • Save dascandy/6a72308f12799fc9c43ce231e1fdfc56 to your computer and use it in GitHub Desktop.

Select an option

Save dascandy/6a72308f12799fc9c43ce231e1fdfc56 to your computer and use it in GitHub Desktop.
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt
index d5852bbff..4e980d1fd 100644
--- a/Kernel/CMakeLists.txt
+++ b/Kernel/CMakeLists.txt
@@ -362,10 +362,9 @@ 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()
@@ -426,6 +425,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()
diff --git a/Kernel/linker.ld b/Kernel/linker.ld
index 2ec733f08..855ddf1e4 100644
--- a/Kernel/linker.ld
+++ b/Kernel/linker.ld
@@ -89,7 +89,7 @@ SECTIONS
start_of_kernel_bss = .;
*(page_tables)
*(COMMON)
- *(.bss)
+ *(.bss*)
end_of_kernel_bss = .;
. = ALIGN(4K);
@@ -101,6 +101,7 @@ SECTIONS
{
start_of_kernel_ksyms = .;
*(.kernel_symbols)
+ *(.got*)
end_of_kernel_ksyms = .;
} :ksyms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment