summaryrefslogtreecommitdiffstats
path: root/kernel/linker.ld
blob: 3f1fe9d7b15117b109ba66c5b1477819a5ddc323 (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
/* the entry point */
ENTRY(_start)

SECTIONS
{
    /* all sections located above 1MB */
    . = 0x100000;

    /* multiboot header first (needs to reside within the first 8KB),
     * then the code itself
     */
    .text BLOCK(4K) : ALIGN(4K)
    {
        *(.multiboot)
        *(.code)
    }

    /* to be sure that this kernel is identified as a multiboot one,
     * the GNU notes information should be placed inside the first 8K.
     * another option is to exclude this unqiue header with -Wl,--build-id=none
     */
    .note.gnu.build-id BLOCK(4K) : ALIGN(4K)
    {
        *(.note.gnu.build-id)
    }

    /* read-only data */
    .rodata BLOCK(4K) : ALIGN(4K)
    {
        *(.rodata*)
    }

    /* read-write data (initialized) */
    .data BLOCK(4K) : ALIGN(4K)
    {
        *(.data*)
    }

    /* read-write data (uninitialized) and stack */
    .bss BLOCK(4K) : ALIGN(4K)
    {
        *(COMMON)
        *(.bss)
        *(.bootstrap_stack)
    }
}