diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 0ea8d132..9f81ecf5 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -211,7 +211,7 @@ elseif("${BANAN_ARCH}" STREQUAL "i686") target_link_options(kernel PRIVATE LINKER:-T,${CMAKE_CURRENT_SOURCE_DIR}/arch/i686/linker.ld) endif() -target_link_options(kernel PRIVATE -ffreestanding -nostdlib) +target_link_options(kernel PRIVATE -ffreestanding -nostdlib -orphan-handling=error) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=crtbegin.o OUTPUT_VARIABLE CRTBEGIN OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=crtend.o OUTPUT_VARIABLE CRTEND OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/kernel/arch/i686/linker.ld b/kernel/arch/i686/linker.ld index 64b107c2..09869cbe 100644 --- a/kernel/arch/i686/linker.ld +++ b/kernel/arch/i686/linker.ld @@ -21,20 +21,20 @@ SECTIONS g_userspace_end = .; g_kernel_execute_end = .; } - .ap_init ALIGN(4K) : AT(ADDR(.ap_init)) + .ap_init ALIGN(4K) : AT(ADDR(.ap_init) - KERNEL_OFFSET) { g_ap_init_addr = .; *(.ap_init) } + .rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET) + { + *(.rodata.*) + } .data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET) { g_kernel_writable_start = .; *(.data) } - .rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET) - { - *(.rodata.*) - } .bss ALIGN(4K) : AT(ADDR(.bss) - KERNEL_OFFSET) { *(COMMON) diff --git a/kernel/arch/x86_64/linker.ld b/kernel/arch/x86_64/linker.ld index d7ccace1..954a9200 100644 --- a/kernel/arch/x86_64/linker.ld +++ b/kernel/arch/x86_64/linker.ld @@ -21,20 +21,20 @@ SECTIONS g_userspace_end = .; g_kernel_execute_end = .; } - .ap_init ALIGN(4K) : AT(ADDR(.ap_init)) + .ap_init ALIGN(4K) : AT(ADDR(.ap_init) - KERNEL_OFFSET) { g_ap_init_addr = .; *(.ap_init) } + .rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET) + { + *(.rodata.*) + } .data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET) { g_kernel_writable_start = .; *(.data) } - .rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET) - { - *(.rodata.*) - } .bss ALIGN(4K) : AT(ADDR(.bss) - KERNEL_OFFSET) { *(COMMON)