-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinker.ld
More file actions
58 lines (49 loc) · 1.16 KB
/
linker.ld
File metadata and controls
58 lines (49 loc) · 1.16 KB
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
/* The bootloader starts execution at _start (defined in your assembly or C). */
ENTRY(_start)
SECTIONS
{
/* Link/load addresses start at 2 MiB (0x00200000). */
. = 0x00200000;
/*
* The .text section, with the multiboot header first,
* so the bootloader sees the magic immediately.
*/
.text BLOCK(4K) : ALIGN(4K)
{
/* Place the multiboot header at the very start */
*(.multiboot)
/* Then the normal .text code */
*(.text)
}
/* Example: place .lowmem after .text. You may choose to put it first if you want. */
.lowmem BLOCK(4K) : ALIGN(4096)
{
*(.lowmem)
}
/* Read-only data. */
.rodata BLOCK(4K) : ALIGN(4K)
{
*(.rodata)
}
/* Initialized data. */
.data BLOCK(4K) : ALIGN(4K)
{
*(.data)
}
/* Uninitialized data (BSS). */
.bss BLOCK(4K) : ALIGN(4K)
{
*(COMMON)
*(.bss)
}
/* Bootstrap stack. */
.bootstrap_stack ALIGN(16) :
{
__stack_bottom = .;
*(.bootstrap_stack)
__stack_top = .;
}
/* Mark the end of the kernel image. */
. = ALIGN(4);
kernel_end = .;
}