RustForge

rust-kernel

Rustbelt: a hobby x86_64 kernel written in Rust

rust-kernel / src / arch / aarch64 / link.ld
1034 bytes ยท raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* Stage 22: where the arm64 kernel lives in memory (QEMU virt).
 *
 * QEMU's virt has RAM from 0x4000_0000 and, for an ELF kernel, puts the
 * device tree at the very start of it. We start 2 MiB in, at 0x4020_0000,
 * and QEMU loads each part of the ELF file at these addresses (the MMU is
 * off, so they are physical addresses) and jumps to _start.
 */
ENTRY(_start)

SECTIONS
{
    . = 0x40200000;
    __kernel_start = .;

    .text : {
        KEEP(*(.text.boot))     /* _start first */
        *(.text .text.*)
    }
    .rodata : ALIGN(16) { *(.rodata .rodata.*) }
    .got : ALIGN(8) { *(.got .got.*) }
    .data : ALIGN(16) { *(.data .data.*) }

    .bss (NOLOAD) : ALIGN(16) {
        __bss_start = .;
        *(.bss .bss.*)
        *(COMMON)
        . = ALIGN(16);
        __bss_end = .;
    }

    /* 64 KiB of stack, growing down from __stack_top. */
    .stack (NOLOAD) : ALIGN(4096) {
        . += 0x10000;
        __stack_top = .;
    }
    __kernel_end = .;

    /DISCARD/ : { *(.comment) *(.eh_frame*) *(.note*) }
}