-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinker.ld
More file actions
73 lines (62 loc) · 1.28 KB
/
Copy pathlinker.ld
File metadata and controls
73 lines (62 loc) · 1.28 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* MakhOS - linker.ld
* Linker script for x86_64 kernel
* Kernel loads at 0x100000 (1MB mark)
*/
ENTRY(start_32bit)
SECTIONS
{
/* Kernel load address at 1MB mark */
. = 0x100000;
/* Multiboot header must be in first 8KB and 8-byte aligned */
.multiboot ALIGN(8) :
{
*(.multiboot)
}
/* Text section (code) */
.text ALIGN(4K) :
{
*(.text)
*(.text.*)
}
/* Read-only data */
.rodata ALIGN(4K) :
{
*(.rodata)
*(.rodata.*)
}
/* User program - text and data MUST be together for RIP-relative addressing */
/* Place both sections consecutively so offsets are correct */
.user_text : {
*(.user_text)
*(.user_text.*)
}
.user_data : {
*(.user_data)
*(.user_data.*)
}
/* Initialized data */
.data ALIGN(4K) :
{
*(.data)
*(.data.*)
}
/* Uninitialized data */
.bss ALIGN(4K) :
{
*(COMMON)
*(.bss)
*(.bss.*)
}
/* Kernel end symbol for memory management */
KERNEL_END = .;
/* Discard unnecessary sections */
/DISCARD/ :
{
*(.comment)
*(.note)
*(.note.*)
*(.eh_frame)
*(.gnu.hash)
}
}