-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkernel.ld
More file actions
74 lines (59 loc) · 1.44 KB
/
kernel.ld
File metadata and controls
74 lines (59 loc) · 1.44 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
74
INCLUDE config.ld
INCLUDE print_info.ld
ENTRY(_start)
PHDRS
{
entry_text_seg PT_LOAD FLAGS(5); /* r-x */
entry_data_seg PT_LOAD FLAGS(6); /* rw- */
text_seg PT_LOAD FLAGS(5); /* r-x */
rodata_seg PT_LOAD FLAGS(4); /* r-- */
data_seg PT_LOAD FLAGS(6); /* rw- */
archive_seg PT_LOAD FLAGS(4); /* r-- */
}
SECTIONS
{
/* The first code that runs in the kernel needs its virtual and physical adddresses to line up */
. = KERN_ENTRY_PADDR;
.entry : AT(KERN_ENTRY_PADDR)
{
*(*.entry.text*);
} :entry_text_seg
.entry :
{
*(*.entry.data*);
} :entry_data_seg
. = KERN_BASE_VADDR;
.text : AT(KERN_BASE_PADDR)
{
*(.text*);
} :text_seg
.rodata : { *(.rodata*); } :rodata_seg
. = ALIGN(PAGE_SIZE);
.data :
{
*(.data*);
} :data_seg
.bss :
{
*(.*bss*);
*(COMMON);
} :data_seg
. = ALIGN(8); /* This assumes that `struct pci_device_driver` is aligned to an 8-byte boundary. */
.pci_device_driver_list :
{
_pci_device_driver_list_start = .;
KEEP(*(SORT_BY_NAME(.pci_device_driver_*)));
_pci_device_driver_list_end = .;
} :data_seg
.rootfs_archive :
{
/* Symbol for the C side to find that data */
_rootfs_archive_start = .;
*(.rootfs_archive*);
_rootfs_archive_end = .;
} :archive_seg
/DISCARD/ :
{
*(.*eh_frame);
}
}