blob: 5dd3ce4d457636eda4a867eb06ded3062a2eda9b (
plain)
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
OUTPUT_ARCH( "mips:riscv" )
ENTRY( __start )
GROUP( -lc -lgloss -lgcc )
SECTIONS
{
/*--------------------------------------------------------------------*/
/* Code and read-only segment */
/*--------------------------------------------------------------------*/
/* Begining of code and text segment */
. = 0x00000000;
.boottext :
{
riscv-pk.o(.boottext)
}
. = 0x70000000;
_ftext = .;
PROVIDE( eprol = . );
/* text: Program code section */
.text :
{
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
}
/* init: Code to execute before main (called by crt1.S) */
.init :
{
KEEP( *(.init) )
}
/* fini: Code to execute after main (called by crt1.S) */
.fini :
{
KEEP( *(.fini) )
}
/* rodata: Read-only data */
.rodata :
{
*(.rdata)
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r.*)
}
/* End of code and read-only segment */
PROVIDE( etext = . );
_etext = .;
/*--------------------------------------------------------------------*/
/* Global constructor/destructor segement */
/*--------------------------------------------------------------------*/
/* The .ctors/.dtors sections are special sections which contain a
list of constructor/destructor function pointers. crtbegin.o
includes code in a .init section which goes through the .ctors list
and calls each constuctor. crtend.o includes code in a .fini
section which goes through the .dtors list and calls each
destructor. crtbegin.o includes a special null pointer in its own
.ctors/.dtors sections which acts as a start indicator for those
lists. crtend.o also includes a special null pointer in its own
.ctors/.dtors sections which acts as an end indictor. The linker
commands below are setup so that crtbegin.o's .ctors/.dtors
sections are always first and crtend.o's .ctors/.dtors sections are
always last. This is the only way the list of functions will have
the begin and end indicators in the right place. */
/* ctors : Array of global constructor function pointers */
.ctors :
{
KEEP( *crtbegin.o(.ctors) )
KEEP( *(EXCLUDE_FILE(*crtend.o) .ctors) )
KEEP( *(SORT(.ctors.*)) )
KEEP( *(.ctors) )
}
/* dtors : Array of global destructor function pointers */
.dtors :
{
KEEP( *crtbegin.o(.dtors) )
KEEP( *(EXCLUDE_FILE(*crtend.o) .dtors) )
KEEP( *(SORT(.dtors.*)) )
KEEP( *(.dtors) )
}
/*--------------------------------------------------------------------*/
/* Other misc gcc segments (this was in idt32.ld) */
/*--------------------------------------------------------------------*/
/* I am not quite sure about these sections but it seems they are for
C++ exception handling. I think .jcr is for "Java Class
Registration" but it seems to end up in C++ binaries as well. */
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : { KEEP( *(.eh_frame) ) }
.gcc_except_table : { *(.gcc_except_table) }
.jcr : { KEEP (*(.jcr)) }
/*--------------------------------------------------------------------*/
/* Initialized data segment */
/*--------------------------------------------------------------------*/
/* Start of initialized data segment */
. = ALIGN(16);
_fdata = .;
/* data: Writable data */
.data :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
}
/* lit4: Single precision floating point constants created by gas */
.lit4 :
{
*(.lit4)
}
/* lit8: Double precision floating point constants created by gas */
.lit8 :
{
*(.lit8)
}
/* End of initialized data segment */
. = ALIGN(4);
PROVIDE( edata = . );
_edata = .;
/*--------------------------------------------------------------------*/
/* Uninitialized data segment */
/*--------------------------------------------------------------------*/
/* Start of uninitialized data segment */
. = .;
_fbss = .;
/* sbss: Uninitialized writeable small data section */
. = .;
_sbss_start = .;
.sbss :
{
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
*(.scommon)
}
/* bss: Uninitialized writeable data section */
. = .;
_bss_start = .;
.bss :
{
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
}
/* End of uninitialized data segment (used by syscalls.c for heap) */
PROVIDE( end = . );
_end = .;
/*--------------------------------------------------------------------*/
/* Special gcc sections (this was in idt32.ld) */
/*--------------------------------------------------------------------*/
.mdebug.abi32 0 : { KEEP(*(.mdebug.abi32)) }
.mdebug.abiN32 0 : { KEEP(*(.mdebug.abiN32)) }
.mdebug.abi64 0 : { KEEP(*(.mdebug.abi64)) }
.mdebug.abiO64 0 : { KEEP(*(.mdebug.abiO64)) }
.mdebug.eabi32 0 : { KEEP(*(.mdebug.eabi32)) }
.mdebug.eabi64 0 : { KEEP(*(.mdebug.eabi64)) }
.gcc_compiled_long32 0 : { KEEP(*(.gcc_compiled_long32)) }
.gcc_compiled_long64 0 : { KEEP(*(.gcc_compiled_long64)) }
}
|