-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathlinker.ld
More file actions
33 lines (26 loc) · 1.09 KB
/
linker.ld
File metadata and controls
33 lines (26 loc) · 1.09 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
/* Linker Script: Defines the memory layout */
ENTRY(_start)
SECTIONS {
. = 0x80000; /* The kernel code must start at the address 0x80000 for Raspberry Pi. */
.text : { *(.text) } :read_execute_segment /* Code goes here. */
.rodata : { *(.rodata) } :read_only_segment /* Initialized read-only data go here. */
.data : { *(.data) } :read_write_segment /* Initialized data go here. */
/* BSS Section: Uninitialized data (like the stack) go here. */
/* This section is ONLY reserved in memory; nothing is written to the output file. */
.bss : {
. = ALIGN(16);
. = . + 0x10000; /* Reserve 64KB for the stack */
__stack_top = .; /* Set the label __stack_top to the end of the reserved space */
} :read_write_segment
/* /DISCARD/ section: Get rid of any unused/unwanted sections */
/DISCARD/ : {
*(.note.gnu.build-id)
*(.ARM.exidx)
}
}
/* Define the loadable segments and set their permissions */
PHDRS {
read_execute_segment PT_LOAD FLAGS(5); /* R + X */
read_only_segment PT_LOAD FLAGS(4); /* R */
read_write_segment PT_LOAD FLAGS(6); /* R + W */
}