-
Notifications
You must be signed in to change notification settings - Fork 0
/
linker.ld
78 lines (62 loc) · 1.17 KB
/
linker.ld
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
KERNEL_VMA = 2M;
ENTRY(_start)
MAGIC_NUMBER = 0xe85250d6;
SECTIONS
{
. = KERNEL_VMA;
KERNEL_START = .;
.boot :
{
header_start = .;
/* Magic number */
LONG(MAGIC_NUMBER)
/* Architecture 0: Protected mode i386 */
LONG(0)
/* Header length */
LONG(header_end - header_start)
/* Checksum */
LONG(0x100000000 - (MAGIC_NUMBER + (header_end - header_start)))
/* Required end tag */
/* Type */
SHORT(0)
/* Flags */
SHORT(0)
/* Size */
LONG(8)
header_end = .;
}
.text BLOCK(4K) : ALIGN(4096)
{
KEEP(*(.text.start))
*(.text)
}
.got BLOCK(4K) : ALIGN(4096)
{
*(.got)
}
.rodata BLOCK(4K) : ALIGN(4096)
{
*(.rodata)
}
.data BLOCK(4K): ALIGN(4096)
{
*(.data)
}
.bss BLOCK(4K): ALIGN(4096)
{
*(COMMON)
*(.bss)
}
.debug BLOCK(4K) : ALIGN(4096)
{
*(.debug)
}
/* Without this kernel end is not incremented to avoid colliding with bss */
.phony : {
}
KERNEL_END = .;
/DISCARD/ :
{
*(.comment)
}
}