Kernel: Make .rodata read-only and add -orphan-handling=error
I don't really know why .rodata was marked writable :D
This commit is contained in:
parent
8da2f12ba6
commit
827eec6af0
|
@ -211,7 +211,7 @@ elseif("${BANAN_ARCH}" STREQUAL "i686")
|
||||||
target_link_options(kernel PRIVATE LINKER:-T,${CMAKE_CURRENT_SOURCE_DIR}/arch/i686/linker.ld)
|
target_link_options(kernel PRIVATE LINKER:-T,${CMAKE_CURRENT_SOURCE_DIR}/arch/i686/linker.ld)
|
||||||
endif()
|
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=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)
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=crtend.o OUTPUT_VARIABLE CRTEND OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
|
@ -21,20 +21,20 @@ SECTIONS
|
||||||
g_userspace_end = .;
|
g_userspace_end = .;
|
||||||
g_kernel_execute_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 = .;
|
g_ap_init_addr = .;
|
||||||
*(.ap_init)
|
*(.ap_init)
|
||||||
}
|
}
|
||||||
|
.rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET)
|
||||||
|
{
|
||||||
|
*(.rodata.*)
|
||||||
|
}
|
||||||
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET)
|
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET)
|
||||||
{
|
{
|
||||||
g_kernel_writable_start = .;
|
g_kernel_writable_start = .;
|
||||||
*(.data)
|
*(.data)
|
||||||
}
|
}
|
||||||
.rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET)
|
|
||||||
{
|
|
||||||
*(.rodata.*)
|
|
||||||
}
|
|
||||||
.bss ALIGN(4K) : AT(ADDR(.bss) - KERNEL_OFFSET)
|
.bss ALIGN(4K) : AT(ADDR(.bss) - KERNEL_OFFSET)
|
||||||
{
|
{
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
|
|
|
@ -21,20 +21,20 @@ SECTIONS
|
||||||
g_userspace_end = .;
|
g_userspace_end = .;
|
||||||
g_kernel_execute_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 = .;
|
g_ap_init_addr = .;
|
||||||
*(.ap_init)
|
*(.ap_init)
|
||||||
}
|
}
|
||||||
|
.rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET)
|
||||||
|
{
|
||||||
|
*(.rodata.*)
|
||||||
|
}
|
||||||
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET)
|
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET)
|
||||||
{
|
{
|
||||||
g_kernel_writable_start = .;
|
g_kernel_writable_start = .;
|
||||||
*(.data)
|
*(.data)
|
||||||
}
|
}
|
||||||
.rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET)
|
|
||||||
{
|
|
||||||
*(.rodata.*)
|
|
||||||
}
|
|
||||||
.bss ALIGN(4K) : AT(ADDR(.bss) - KERNEL_OFFSET)
|
.bss ALIGN(4K) : AT(ADDR(.bss) - KERNEL_OFFSET)
|
||||||
{
|
{
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
|
|
Loading…
Reference in New Issue