-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinker.ld
76 lines (55 loc) · 1.37 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(start)
KERNEL_LMA = 0x0000000000200000;
VIRT_ADDR = 0xffffffff80000000;
KERNEL_VMA = VIRT_ADDR + KERNEL_LMA;
SECTIONS {
. = KERNEL_VMA;
_start = .;
.boot : AT(ADDR(.boot) - VIRT_ADDR)
{
/* ensure that the multiboot header is at the beginning */
*(.multiboot_header)
. = ALIGN(4K);
}
_kernel_start = .;
.text : AT(ADDR(.text) - VIRT_ADDR)
{
code = .; _code = .; __code = .;
*(.text)
*(.gnu.linkonce.b*)
. = ALIGN(4K);
}
/* Read-write data (initialized) */
.rodata ALIGN(4K) : AT(ADDR(.rodata) - VIRT_ADDR)
{
_rdata = .;
*(.rodata .rodata*)
*(.gnu.linkonce.r*)
}
/* . += 2M;removed BLOCK(4K) for this and bss */
.data : AT(ADDR(.data) - VIRT_ADDR)
{
_data = .;
*(.data .data*)
*(.gnu.linkonce.r*)
. = ALIGN(4K);
}
_edata = .;
/* Read-write data (uninitialized) and stack */
.bss : AT(ADDR(.bss) - VIRT_ADDR)
{
bss = .; _bss = .; __bss = .;
*(COMMON)
*(.bss)
ebss = .;
*(.gnu.linkonce.b*)
. = ALIGN(4K);
}
end = .; _end = .; __end = .; _kernel_end = .;
/DISCARD/ :
{
*(.comment)
*(note.*)
*(.eh_frame) /* stuff for cpp rt excepts, rtti etc we arent gonna use */
}
}