-
Notifications
You must be signed in to change notification settings - Fork 3
/
link.ld
36 lines (32 loc) · 769 Bytes
/
link.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
/* Linker script for unix from scratch tutorial from
* http://www.jamesmolloy.co.uk/tutorial_html/1.-Environment%20setup.html
*/
OUTPUT_FORMAT(elf32-i386)
ENTRY(start) /* start location for binary is 'start' */
SECTIONS
{
/* '.text' section should be first in the image, starting at 1 MB */
.text 0x100000 :
{
code = .; _code = .; __code = .; /* TODO: what's this do? */
*(.text)
. = ALIGN(4096); /* page-aligned */
}
/* '.data' section is next */
.data :
{
data = .; _data = .; __data = .;
*(.data)
*(.rodata) /* linux GCC adds read-only data, put it here too */
. = ALIGN(4096);
}
/* '.bss' section is last */
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
/* here it ends */
end = .; _end = .; __end = .;
}