summaryrefslogtreecommitdiff
path: root/kernel/arch/aarch64/linker.ld
blob: 4eb0ced8b7d46c8d903b42207a2713a267a7a601 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * kernel/arch/aarch64/linker.ld
 *
 * Linker script for the AArch64 kernel ELF binary.
 * Loaded at 0x40100000 (typical for QEMU virt machine).
 *  
 * 4K align is same reason with boot linker scripts - page-aligned sections allow per-section memory protection
 * TODO: rewrite it after i will add normal paging 
 */

ENTRY(_start)

/*
    KERNEL_PHYS_BASE - kernel base address, for aarch64 it's 0x40100000 because
    in QEMU RAM starts at 0x4000000, and we add 1MiB for BIOS data
*/
KERNEL_PHYS_BASE = 0x40100000;

SECTIONS
{
    . = KERNEL_PHYS_BASE;

    .text ALIGN(4K) : {
        __text_start = .;
        *(.text .text.*)
        __text_end = .;
    }

    .rodata ALIGN(4K) : {
        __rodata_start = .;
        *(.rodata .rodata.*)
        __rodata_end = .;
    }

    .data ALIGN(4K) : {
        __data_start = .;
        *(.data .data.*)
        __data_end = .;
    }

    .bss ALIGN(4K) : {
        __bss_start = .;
        *(.bss .bss.*)
        *(COMMON)
        __bss_end = .;
    }

    __kernel_end = .;

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