-
Notifications
You must be signed in to change notification settings - Fork 42
/
link.ld
103 lines (87 loc) · 1.93 KB
/
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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* Copyright TU Wien */
/* Licensed under the ISC license, see LICENSE.txt for details */
/* SPDX-License-Identifier: ISC */
OUTPUT_ARCH(riscv)
ENTRY(_start)
SEARCH_DIR(.)
__DYNAMIC = 0;
MEMORY
{
boot : ORIGIN = 0x00000000, LENGTH = 0x00002000 /* 8 kB */
ram : ORIGIN = 0x00002000, LENGTH = 0x0003E000 /* 248 kB */
}
STACK_LEN = 0x4000; /* 16 kB */
SECTIONS
{
.vectors 0 : {
*(.vectors)
} >boot
.text : {
. = ALIGN(4);
_stext = .;
*(.text)
*(.text.*)
_etext = .;
__CTOR_LIST__ = .;
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
*(.ctors)
LONG(0)
__CTOR_END__ = .;
__DTOR_LIST__ = .;
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
*(.dtors)
LONG(0)
__DTOR_END__ = .;
*(.lit)
*(.shdata)
. = ALIGN(4);
_endtext = .;
} >ram
.rodata : {
. = ALIGN(4);
*(.rodata);
*(.rodata.*)
} >ram
.shbss : {
. = ALIGN(4);
*(.shbss)
} >ram
.data : {
. = ALIGN(4);
sdata = .;
_sdata = .;
*(.data);
*(.data.*)
edata = .;
_edata = .;
} >ram
.bss (NOLOAD) : {
. = ALIGN(4);
_bss_start = .;
*(.bss)
*(.bss.*)
*(.sbss)
*(.sbss.*)
*(COMMON)
_bss_end = .;
} >ram
.user_align (NOLOAD) : {
. = ALIGN(0x1000);
_user_start = .;
} >ram
.stack ORIGIN(ram) + LENGTH(ram) - STACK_LEN (NOLOAD) : {
. = ALIGN(16);
_stack_start = .;
. = . + STACK_LEN;
. = ALIGN(16);
stack = .;
_stack = .;
_stack_end = .;
} >ram
.stab 0 (NOLOAD) : {
[ .stab ]
}
.stabstr 0 (NOLOAD) : {
[ .stabstr ]
}
}