-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.ld
More file actions
75 lines (68 loc) · 1.11 KB
/
link.ld
File metadata and controls
75 lines (68 loc) · 1.11 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
OUTPUT_FORMAT("binary")
ENTRY(start32)
begin = 0x100000;
SECTIONS
{
/*
.header begin : AT(begin)
{
LONG(0);
LONG(0);
multiboot_header = .;
LONG(0x1badb002);
LONG(0x10003);
LONG(-(0x1badb002 + 0x10003));
LONG(multiboot_header);
LONG(text);
LONG(bss);
LONG(end);
LONG(start32);
. += 16;
}
*/
.header begin :AT(begin)
{
text = .;
*(.header)
*(.isr)
*(.stext)
*(.sdata)
*(.sbss)
. = ALIGN(4096);
}
.text : AT(ADDR(.header) + SIZEOF(.header))
{
*(.text)
. = ALIGN(4096);
}
.data : AT(ADDR(.header) + SIZEOF(.text) + SIZEOF(.header))
{
data = .;
*(.data)
*(.rodata)
*(.gdtbl)
page_size = .;
QUAD(4096);
int_table = .;
*(.inttable)
int_table_end = .;
int_table_size = .;
QUAD((int_table_end - int_table) / 16);
kern_start = .;
QUAD(text);
head_magic = .;
QUAD(multiboot_header);
. = ALIGN(4096);
}
.bss : AT(ADDR(.header) + SIZEOF(.text) +SIZEOF(.data) + SIZEOF(.header))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = ADDR(.header) + SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.bss) + SIZEOF(.header);
/DISCARD/ :
{
*(.eh_frame)
}
}