mirror of
https://github.com/RGBCube/serenity
synced 2025-07-29 17:27:35 +00:00
Kernel: Adjust aarch64 linker script
- .text now starts at 0x80000, where an actual (non-qemu) RPi expects - use magic section name ".text.first" to make sure the linker script puts the kernel entry point at the start of the .text section - remove a few things from the x86 linker script that aren't needed for aarch64 (yet?)
This commit is contained in:
parent
cbdf4b575d
commit
4c876e88e0
3 changed files with 5 additions and 23 deletions
|
@ -4,7 +4,8 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.text
|
// In a specially-named text section so that the linker script can put it first in .text.
|
||||||
|
.section ".text.first"
|
||||||
|
|
||||||
.global start
|
.global start
|
||||||
.type start, @function
|
.type start, @function
|
||||||
|
|
|
@ -2,7 +2,6 @@ ENTRY(start)
|
||||||
|
|
||||||
PHDRS
|
PHDRS
|
||||||
{
|
{
|
||||||
boot_text PT_LOAD ;
|
|
||||||
text PT_LOAD ;
|
text PT_LOAD ;
|
||||||
data PT_LOAD ;
|
data PT_LOAD ;
|
||||||
bss PT_LOAD ;
|
bss PT_LOAD ;
|
||||||
|
@ -10,18 +9,11 @@ PHDRS
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
. = 0x00100000;
|
. = 0x00080000;
|
||||||
|
|
||||||
start_of_prekernel_image = .;
|
|
||||||
|
|
||||||
.boot_text ALIGN(4K) : AT (ADDR(.boot_text))
|
|
||||||
{
|
|
||||||
KEEP(*(.multiboot))
|
|
||||||
} :boot_text
|
|
||||||
|
|
||||||
.text ALIGN(4K) : AT (ADDR(.text))
|
.text ALIGN(4K) : AT (ADDR(.text))
|
||||||
{
|
{
|
||||||
start_of_prekernel_text = .;
|
*(.text.first)
|
||||||
*(.text*)
|
*(.text*)
|
||||||
} :text
|
} :text
|
||||||
|
|
||||||
|
@ -37,11 +29,6 @@ SECTIONS
|
||||||
|
|
||||||
.bss ALIGN(4K) (NOLOAD) : AT (ADDR(.bss))
|
.bss ALIGN(4K) (NOLOAD) : AT (ADDR(.bss))
|
||||||
{
|
{
|
||||||
*(COMMON)
|
|
||||||
*(.bss)
|
*(.bss)
|
||||||
*(.stack)
|
|
||||||
*(.page_tables)
|
|
||||||
} :bss
|
} :bss
|
||||||
|
|
||||||
end_of_prekernel_image = .;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,19 +4,13 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
# This has to be first, so that the entry point is at the start of the image.
|
|
||||||
# Needed because:
|
|
||||||
# - execution starts at the start of the image
|
|
||||||
# - the stack pointer currently starts before the start symbol, so if the start symbol isn't the first symbol, the stack will clobber arbitrary code
|
|
||||||
# FIXME: Use an aarch64-specific linker script instead.
|
|
||||||
Arch/aarch64/boot.S
|
|
||||||
|
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
Arch/aarch64/GPIO.cpp
|
Arch/aarch64/GPIO.cpp
|
||||||
Arch/aarch64/Mailbox.cpp
|
Arch/aarch64/Mailbox.cpp
|
||||||
Arch/aarch64/MainIdRegister.cpp
|
Arch/aarch64/MainIdRegister.cpp
|
||||||
Arch/aarch64/MMIO.cpp
|
Arch/aarch64/MMIO.cpp
|
||||||
Arch/aarch64/UART.cpp
|
Arch/aarch64/UART.cpp
|
||||||
|
Arch/aarch64/boot.S
|
||||||
Arch/aarch64/init.cpp
|
Arch/aarch64/init.cpp
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue