-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinker.ld
76 lines (61 loc) · 1.58 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
ENTRY(entryPoint)
SECTIONS
{
. = 0x100000;
/* this must be first, so that grub/multiboot finds it */
.boot.boot ALIGN(0x1000) : AT(ADDR(.boot.boot)) {
*(.boot.boot*)
}
. += KERNBASE;
.boot.text ALIGN(0x1000) : AT(ADDR(.boot.text) - KERNBASE) {
*(.boot.text*)
}
.boot.data ALIGN(0x1000) : AT(ADDR(.boot.data) - KERNBASE) {
*(.boot.data*)
}
.ctors ALIGN(0x1000) : AT(ADDR(.ctors) - KERNBASE) {
*(.ctors*)
}
.text ALIGN(0x200000) : AT(ADDR(.text) - KERNBASE) {
*(.text*)
*(.gnu.linkonce.text*)
}
.rodata ALIGN(0x1000) : AT(ADDR(.rodata) - KERNBASE) {
*(.rodata*)
*(.gnu.linkonce.rodata*)
}
/*
.gcc_except_table : {
*(.gcc_except_table*)
}
*/
.data ALIGN(0x200000) : AT(ADDR(.data) - KERNBASE) {
*(.data*)
*(.gnu.linkonce.data*)
}
.bss ALIGN(0x1000) : AT(ADDR(.bss) - KERNBASE) {
*(COMMON)
*(.bss*)
*(.gnu.linkonce.b*)
}
/DISCARD/ : {
*(.comment*)
*(.eh_frame*)
*(.gcc_except_table*)
}
__MultibootHdr = ALIGN(0x200000) - KERNBASE;
__KernelBoot = ADDR(.boot.boot) + KERNBASE;
__KernelBootEnd = ADDR(.boot.data) + SIZEOF(.boot.data);
__KernelCtors = ADDR(.ctors);
__KernelCtorsEnd = ADDR(.ctors) + SIZEOF(.ctors);
__KernelCode = ADDR(.text);
__KernelCodeEnd = ADDR(.text) + SIZEOF(.text);
__KernelRO = ADDR(.rodata);
__KernelRO_End = ADDR(.rodata) + SIZEOF(.rodata);
__KernelData = ADDR(.data);
__KernelDataEnd = ADDR(.data) + SIZEOF(.data);
__KernelBss = ADDR(.bss);
__KernelBssEnd = ADDR(.bss) + SIZEOF(.bss);
__loadStart = __KernelBoot - KERNBASE;
__loadEnd = __KernelBss - KERNBASE;
}