-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathbase.ld
128 lines (114 loc) · 2.71 KB
/
base.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* Copyright 2020 ETH Zurich and University of Bologna. */
/* Solderpad Hardware License, Version 0.51, see LICENSE for details. */
/* SPDX-License-Identifier: SHL-0.51 */
OUTPUT_ARCH( "riscv" )
ENTRY(_start)
/* Memory section should be provided in a separate, platform-specific */
/* file. It should define at least the L1 and L3 memory blocks. */
INCLUDE memory.ld
SECTIONS
{
/* Program code goes into L3 */
.text :
{
. = ALIGN(4);
*(.init)
*(.text.init)
*(.text.startup)
*(.text)
*(.text*)
*(.text)
. = ALIGN(4);
_etext = .;
} >L3
/* By default, constant data goes into L3, right after code section */
.rodata :
{
. = ALIGN(4);
*(.rodata)
*(.rodata*)
. = ALIGN(4);
} >L3
/* HTIF section for FESVR */
.htif : { } >L3
/* Thread Local Storage sections */
.tdata :
{
__tdata_start = .;
*(.tdata .tdata.* .gnu.linkonce.td.*)
__tdata_end = .;
} >L3
.tbss :
{
__tbss_start = .;
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
__tbss_end = .;
} >L3
/* add a section after .tbss to put the __tbss_end symbol into for
the LLD linker */
.tbssend : { __tbss_end2 = .; }
/* Cluster Local Storage sections */
.cdata :
{
__cdata_start = .;
*(.cdata .cdata.*)
__cdata_end = .;
} >L3
.cbss :
{
__cbss_start = .;
KEEP(*(.cbss .cbss.*))
__cbss_end = .;
} >L3
/* used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* small data section that can be addressed through the global pointer */
.sdata :
{
__SDATA_BEGIN__ = .;
__global_pointer$ = . + 0x7f0;
*(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata .srodata.*)
*(.sdata .sdata.* .gnu.linkonce.s.*)
} >L3
/* Initialized data sections goes into L3 */
.data :
{
__DATA_BEGIN__ = .;
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} >L3
_edata = .; PROVIDE (edata = .);
/* small bss section */
. = .;
__bss_start = .;
.sbss :
{
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
} >L3
/* Uninitialized data section */
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(. != 0 ? 32 / 8 : 1);
} >L3
. = ALIGN(32 / 8);
. = SEGMENT_START("ldata-segment", .);
. = ALIGN(32 / 8);
__BSS_END__ = .;
__bss_end = .;
_end = .; PROVIDE (end = .);
/* Uninitialized data section in L3 */
.dram :
{
*(.dram)
_edram = .;
} >L3
}