forked from Cybersecurity-Enthusiasts-CE/OpenOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinker.ld
More file actions
72 lines (63 loc) · 1.73 KB
/
Copy pathlinker.ld
File metadata and controls
72 lines (63 loc) · 1.73 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
/*
* OpenOS Linker Script
* Defines the memory layout and section arrangement for the kernel
*/
/* Entry point symbol from boot.S */
ENTRY(_start)
SECTIONS
{
/* Load the kernel at 1 MiB (0x100000)
* This is a standard location above conventional memory
* and below the 4 GiB boundary for 32-bit addressing
*/
. = 1M;
/* Physical start of the kernel image. The PMM uses this (together with
* kernel_end below) to reserve the kernel's own page frames so the
* allocator never hands out memory the running kernel occupies. */
kernel_start = .;
/* Multiboot header must be in the first 8 KiB of the kernel
* This section contains the Multiboot magic, flags, and checksum
* It MUST be placed at the very start before all other sections
*/
.text :
{
/* Place multiboot header first, before any code */
*(.multiboot)
/* Then place all code sections */
*(.text*)
}
/* Read-only data section - contains string literals and const data
* Aligned to 4 KiB for memory protection (future)
*/
.rodata ALIGN(4K) :
{
*(.rodata*)
}
/* Initialized data section - contains global/static variables
* with initial values
*/
.data ALIGN(4K) :
{
*(.data*)
}
/* Uninitialized data section - contains global/static variables
* without initial values (zeroed by bootloader)
* COMMON is for uninitialized C data
*/
.bss ALIGN(4K) :
{
*(.bss*)
*(COMMON)
}
/* Physical end of the kernel image (exclusive). Everything in
* [kernel_start, kernel_end) is the loaded kernel and must be
* reserved by the physical memory manager. */
kernel_end = .;
/* Discard unnecessary sections */
/DISCARD/ :
{
*(.note.gnu.build-id)
*(.comment)
*(.eh_frame)
}
}