summaryrefslogtreecommitdiff
path: root/Kernel/Arch/aarch64/linker.ld
blob: 2fc3a528858523f12a9e91c48868431c2d3a1a51 (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
79
80
81
82
83
ENTRY(start)

/* TODO: Add FLAGS to the program headers */
PHDRS
{
  text PT_LOAD ;
  data PT_LOAD ;
  bss PT_LOAD ;
  super_pages PT_LOAD ;
  ksyms PT_LOAD ;
}

SECTIONS
{
    . = 0x00080000;

    .text ALIGN(4K) : AT (ADDR(.text))
    {
        *(.text.first)
        *(.text*)
    } :text

    .rodata ALIGN(4K) : AT (ADDR(.rodata))
    {
        start_ctors = .;
        *(.init_array)
        end_ctors = .;

        *(.rodata*)
    } :data

    .data ALIGN(4K) : AT (ADDR(.data))
    {
        *(.data*)
    } :data

    .bss ALIGN(4K) (NOLOAD) : AT (ADDR(.bss))
    {
	start_of_bss = .;
        *(.bss)
	end_of_bss = .;

        . = ALIGN(4K);
        *(.heap)
    } :bss

    .super_pages ALIGN(4K) (NOLOAD) : AT (ADDR(.super_pages))
    {
        *(.super_pages)
    } :super_pages

    .ksyms ALIGN(4K) : AT (ADDR(.ksyms))
    {
        start_of_kernel_ksyms = .;
        *(.kernel_symbols)
        end_of_kernel_ksyms = .;
    } :ksyms

    /*
        FIXME: 8MB is enough space for all of the tables required to identity map 
               physical memory. 8M is wasteful, so this should be properly calculated.
    */
    
    /* FIXME: Placeholder to satisfy linker */
    start_of_kernel_text = .;
    end_of_kernel_text = .;
    start_of_kernel_image = .;
    end_of_kernel_image = .;
    start_of_unmap_after_init = .;
    end_of_unmap_after_init = .;
    start_of_ro_after_init = .;
    end_of_ro_after_init = .;
    start_of_kernel_data = .;
    end_of_kernel_data = .;

    . = ALIGN(4K);
    page_tables_phys_start = .;
    
    . += 8M;
    page_tables_phys_end = .;
}

size_of_bss_divided_by_8 = (end_of_bss - start_of_bss) / 8;