summaryrefslogtreecommitdiff
path: root/Kernel/linker.ld
blob: fcc4eee9337759d3dc3b652eb19f6b2facab1c79 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
ENTRY(start)

KERNEL_VIRTUAL_BASE = 0xc0000000;

SECTIONS
{
    . = KERNEL_VIRTUAL_BASE + 0x00100000;

    start_of_kernel_image = .;

    .text ALIGN(4K) : AT (ADDR(.text) - KERNEL_VIRTUAL_BASE)
    {
        $<TARGET_OBJECTS:boot>
        *(.multiboot)
        start_of_kernel_text = .;

        start_of_safemem_text = .;
        KEEP(*(.text.safemem))
        end_of_safemem_text = .;
        start_of_safemem_atomic_text = .;
        KEEP(*(.text.safemem.atomic))
        end_of_safemem_atomic_text = .;

        *(.text*)
    }

    .unmap_after_init ALIGN(4K) : AT (ADDR(.unmap_after_init) - KERNEL_VIRTUAL_BASE)
    {
        start_of_unmap_after_init = .;
        *(.unmap_after_init*);
        end_of_unmap_after_init = .;

        end_of_kernel_text = .;
    }

    .rodata ALIGN(4K) : AT (ADDR(.rodata) - KERNEL_VIRTUAL_BASE)
    {
        start_heap_ctors = .;
        *libkernel_heap.a:*(.ctors)
        end_heap_ctors = .;

        start_ctors = .;
        *(.ctors)
        end_ctors = .;

        *(.rodata*)
    }

    .data ALIGN(4K) : AT (ADDR(.data) - KERNEL_VIRTUAL_BASE)
    {
        start_of_kernel_data = .;
        *(.data*)
        end_of_kernel_data = .;
    }

    .ro_after_init ALIGN(4K) (NOLOAD) : AT(ADDR(.ro_after_init) - KERNEL_VIRTUAL_BASE)
    {
        start_of_ro_after_init = .;
        *(.ro_after_init);
        end_of_ro_after_init = .;
    }

    .bss ALIGN(4K) (NOLOAD) : AT (ADDR(.bss) - KERNEL_VIRTUAL_BASE)
    {
        start_of_kernel_bss = .;
        *(page_tables)
        *(COMMON)
        *(.bss)
        end_of_kernel_bss = .;

        . = ALIGN(4K);
        *(.heap)
        . = ALIGN(4K);
        *(.super_pages)
    }

    end_of_kernel_image = .;
}