Fix entry point to always start a binary

Keep vectors table.
Do not keep boot data if not referenced.
This commit is contained in:
Berkus Decker 2020-09-13 20:49:29 +03:00
parent 34115db6f6
commit 9fd9612b77
2 changed files with 5 additions and 4 deletions

View File

@ -16,9 +16,10 @@ SECTIONS
__boot_start = .;
.text :
{
KEEP(*(.text.boot))
KEEP(*(.text.boot.entry)) // Entry point must go first
*(.text.boot)
. = ALIGN(4096);
KEEP(*(.data.boot))
*(.data.boot)
. = ALIGN(4096); /* Here boot code ends */
__boot_end = .; // __boot_end must be 4KiB aligned
__ro_start = .;
@ -27,7 +28,7 @@ SECTIONS
.vectors ALIGN(2048):
{
*(.vectors)
KEEP(*(.vectors))
}
.rodata ALIGN(4):

View File

@ -179,7 +179,7 @@ fn setup_and_enter_el1_from_el3() -> ! {
/// [here](https://leiradel.github.io/2019/01/20/Raspberry-Pi-Stubs.html).
///
#[no_mangle]
#[link_section = ".text.boot"]
#[link_section = ".text.boot.entry"]
pub unsafe extern "C" fn _boot_cores() -> ! {
const CORE_0: u64 = 0;
const CORE_MASK: u64 = 0x3;