aboutsummaryrefslogtreecommitdiff
path: root/linker.ld
blob: 199cc0f232097a7ddfa8f67139126085cdc414ae (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
84
85
86
87
88
89
90
91
92
93
94
ENTRY(_start)
 
SECTIONS
{
    /* Starts at LOADER_ADDR, which is 0x8000 - that's where RPis in */
    /* 32-bit mode load kernel at. */
    /* My experiments do, however, show, that qemu emulating RPi2 */
    /* loads the kernel at 0x10000! (took some pain to find out). */
    /* Since we're using a bootloader now, we can compile the kernel */
    /* for 0x8000 and bootloader will load it properly (although it */
    /* itself still has to be compiled for 0x10000) */
    /* rpi-open-firmware, ont he other hand, loads kernel at 0x2000000 */
    /* This issue is also to be avoided by the use of bootloader */
    . = 0x8000;
    /* For AArch64, use . = 0x80000; Unless this too is wrong in qemu… */
    
    __start = .;
    __text_start = .;
    .text :
    {
        KEEP(*(.text.boot))
        *(.text)
    }
    . = ALIGN(4096); /* align to page size */
    __text_end = .;
 
    __rodata_start = .;
    .rodata :
    {
        *(.rodata)
    }
    . = ALIGN(4096); /* align to page size */
    __rodata_end = .;
 
    __data_start = .;
    .data :
    {
        *(.data)
    }
    . = ALIGN(4096); /* align to page size */
    __data_end = .;
 
    __bss_start = .;
    .bss :
    {
        bss = .;
        *(.bss)
    }
    . = ALIGN(4096); /* align to page size */
    __bss_end = .;
    __bss_size = __bss_end - __bss_start;



    /* Here come the definitions for renamed sections */
    __renamed_start = .;
    __renamed_text_start = .;
    .renamed_text :
    {
        *(.renamed_text)
    }
    . = ALIGN(4096); /* align to page size */
    __renamed_text_end = .;
 
    __renamed_rodata_start = .;
    .renamed_rodata :
    {
        *(.renamed_rodata)
    }
    . = ALIGN(4096); /* align to page size */
    __renamed_rodata_end = .;
 
    __renamed_data_start = .;
    .renamed_data :
    {
        *(.renamed_data)
    }
    . = ALIGN(4096); /* align to page size */
    __renamed_data_end = .;
 
    __renamed_bss_start = .;
    .renamed_bss :
    {
        renamed_bss = .;
        *(.renamed_bss)
    }
    . = ALIGN(4096); /* align to page size */
    __renamed_bss_end = .;
    __renamed_bss_size = __renamed_bss_end - __renamed_bss_start;
    __renamed_end = .;
    __renamed_size = __renamed_end - __renamed_start;
    
    __end = .;
}