mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
Kernel: Move prekernel linker.ld into Arch subdirectories
This moves Kernel/Prekernel/linker.ld unchanged to Kernel/Prekernel/Arch/aarch64 and Kernel/Prekernel/Arch/x86. The aarch64 will change in a future commit. No behavior change.
This commit is contained in:
parent
5bb2e6597a
commit
cbdf4b575d
3 changed files with 54 additions and 2 deletions
47
Kernel/Prekernel/Arch/x86/linker.ld
Normal file
47
Kernel/Prekernel/Arch/x86/linker.ld
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
ENTRY(start)
|
||||||
|
|
||||||
|
PHDRS
|
||||||
|
{
|
||||||
|
boot_text PT_LOAD ;
|
||||||
|
text PT_LOAD ;
|
||||||
|
data PT_LOAD ;
|
||||||
|
bss PT_LOAD ;
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
. = 0x00100000;
|
||||||
|
|
||||||
|
start_of_prekernel_image = .;
|
||||||
|
|
||||||
|
.boot_text ALIGN(4K) : AT (ADDR(.boot_text))
|
||||||
|
{
|
||||||
|
KEEP(*(.multiboot))
|
||||||
|
} :boot_text
|
||||||
|
|
||||||
|
.text ALIGN(4K) : AT (ADDR(.text))
|
||||||
|
{
|
||||||
|
start_of_prekernel_text = .;
|
||||||
|
*(.text*)
|
||||||
|
} :text
|
||||||
|
|
||||||
|
.rodata ALIGN(4K) : AT (ADDR(.rodata))
|
||||||
|
{
|
||||||
|
*(.rodata*)
|
||||||
|
} :data
|
||||||
|
|
||||||
|
.data ALIGN(4K) : AT (ADDR(.data))
|
||||||
|
{
|
||||||
|
*(.data*)
|
||||||
|
} :data
|
||||||
|
|
||||||
|
.bss ALIGN(4K) (NOLOAD) : AT (ADDR(.bss))
|
||||||
|
{
|
||||||
|
*(COMMON)
|
||||||
|
*(.bss)
|
||||||
|
*(.stack)
|
||||||
|
*(.page_tables)
|
||||||
|
} :bss
|
||||||
|
|
||||||
|
end_of_prekernel_image = .;
|
||||||
|
}
|
|
@ -44,8 +44,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
||||||
add_executable(${PREKERNEL_TARGET} ${SOURCES})
|
add_executable(${PREKERNEL_TARGET} ${SOURCES})
|
||||||
target_compile_options(${PREKERNEL_TARGET} PRIVATE -no-pie -fno-pic -fno-threadsafe-statics)
|
target_compile_options(${PREKERNEL_TARGET} PRIVATE -no-pie -fno-pic -fno-threadsafe-statics)
|
||||||
|
|
||||||
target_link_options(${PREKERNEL_TARGET} PRIVATE LINKER:-T ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld -nostdlib LINKER:--no-pie)
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
||||||
set_target_properties(${PREKERNEL_TARGET} PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld)
|
set(PREKERNEL_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Arch/aarch64/linker.ld")
|
||||||
|
else()
|
||||||
|
set(PREKERNEL_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/linker.ld")
|
||||||
|
endif()
|
||||||
|
target_link_options(${PREKERNEL_TARGET} PRIVATE LINKER:-T ${PREKERNEL_LINKER_SCRIPT} -nostdlib LINKER:--no-pie)
|
||||||
|
set_target_properties(${PREKERNEL_TARGET} PROPERTIES LINK_DEPENDS ${PREKERNEL_LINKER_SCRIPT})
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
target_link_libraries(${PREKERNEL_TARGET} PRIVATE gcc)
|
target_link_libraries(${PREKERNEL_TARGET} PRIVATE gcc)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue