1 | /* |
---|
2 | * This file contains directives for the GNU linker which are specific to the |
---|
3 | * Virtex 5 PPC 440. No assumptions are made on the firmware in the FPGA. |
---|
4 | * This file is intended to be used together with start.S to generate |
---|
5 | * downloadable code. |
---|
6 | */ |
---|
7 | |
---|
8 | OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") |
---|
9 | OUTPUT_ARCH(powerpc) |
---|
10 | |
---|
11 | ENTRY(download_entry) |
---|
12 | EXTERN(download_entry) |
---|
13 | EXTERN(__vectors) |
---|
14 | |
---|
15 | MsgAreaSize = DEFINED(MsgAreaSize) ? MsgAreaSize : 1M; |
---|
16 | RamBase = DEFINED(RamBase) ? RamBase : 0x0; |
---|
17 | RamSize = DEFINED(RamSize) ? RamSize : 2048M - MsgAreaSize; |
---|
18 | IntrStackSize = DEFINED(IntrStackSize) ? IntrStackSize : 16K; |
---|
19 | StackSize = DEFINED(StackSize) ? StackSize : 64K; |
---|
20 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0; /* 0=Use def */ |
---|
21 | |
---|
22 | |
---|
23 | MEMORY |
---|
24 | { |
---|
25 | VECTORS : ORIGIN = 0x00000000, LENGTH = 512 |
---|
26 | RAM : ORIGIN = 0x00000200, LENGTH = 2048M - 512 |
---|
27 | } |
---|
28 | |
---|
29 | |
---|
30 | SECTIONS |
---|
31 | { |
---|
32 | bsp_exc_vector_base = 0; |
---|
33 | __exeentry = download_entry; |
---|
34 | __exestart = bsp_exc_vector_base; |
---|
35 | .vectors bsp_exc_vector_base : { *(.vectors) } > VECTORS |
---|
36 | |
---|
37 | /* Read-only sections, merged into text segment: */ |
---|
38 | .interp : { *(.interp) } > RAM |
---|
39 | .hash : { *(.hash) } > RAM |
---|
40 | .dynsym : { *(.dynsym) } > RAM |
---|
41 | .dynstr : { *(.dynstr) } > RAM |
---|
42 | .gnu.version : { *(.gnu.version) } > RAM |
---|
43 | .gnu.version_d : { *(.gnu.version_d) } > RAM |
---|
44 | .gnu.version_r : { *(.gnu.version_r) } > RAM |
---|
45 | .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } > RAM |
---|
46 | .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } > RAM |
---|
47 | .rela.rodata : { *(.rela.rodata*) *(.rela.gnu.linkonce.r*) } > RAM |
---|
48 | .rela.got : { *(.rela.got) } > RAM |
---|
49 | .rela.got1 : { *(.rela.got1) } > RAM |
---|
50 | .rela.got2 : { *(.rela.got2) } > RAM |
---|
51 | .rela.ctors : { *(.rela.ctors) } > RAM |
---|
52 | .rela.dtors : { *(.rela.dtors) } > RAM |
---|
53 | .rela.init : { *(.rela.init) } > RAM |
---|
54 | .rela.fini : { *(.rela.fini) } > RAM |
---|
55 | .rela.bss : { *(.rela.bss) } > RAM |
---|
56 | .rela.plt : { *(.rela.plt) } > RAM |
---|
57 | .rela.sdata : { *(.rela.sdata) } > RAM |
---|
58 | .rela.sbss : { *(.rela.sbss) } > RAM |
---|
59 | .rela.sdata2 : { *(.rela.sdata2) } > RAM |
---|
60 | .rela.sbss2 : { *(.rela.sbss2) } > RAM |
---|
61 | .rela.dyn : { *(.rela.dyn) } > RAM |
---|
62 | |
---|
63 | /* Initialization code */ |
---|
64 | .init : { PROVIDE (_init = .); |
---|
65 | *ecrti.o(.init) |
---|
66 | KEEP(*(.init)) |
---|
67 | *ecrtn.o(.init) |
---|
68 | } > RAM |
---|
69 | |
---|
70 | .text : { *(.entry) |
---|
71 | *(.text) |
---|
72 | *(.text.*) |
---|
73 | |
---|
74 | /* Special FreeBSD sysctl sections */ |
---|
75 | . = ALIGN (16); |
---|
76 | __start_set_sysctl_set = .; |
---|
77 | *(set_sysctl_*); |
---|
78 | __stop_set_sysctl_set = ABSOLUTE(.); |
---|
79 | *(set_domain_*); |
---|
80 | *(set_pseudo_*); |
---|
81 | |
---|
82 | /* .gnu.warning sections are handled specially by elf32.em |
---|
83 | */ |
---|
84 | *(.gnu.warning) |
---|
85 | *(.gnu.linkonce.t*) |
---|
86 | } > RAM |
---|
87 | |
---|
88 | /* Finalization code */ |
---|
89 | .fini : { PROVIDE (_fini = .); |
---|
90 | *ecrti.o(.fini) |
---|
91 | KEEP(*(.fini)) |
---|
92 | *ecrtn.o(.fini) |
---|
93 | } > RAM |
---|
94 | |
---|
95 | /* Miscellaneous read-only data */ |
---|
96 | .rodata : { *(.rodata.* .gnu.linkonce.r*) KEEP (*(SORT(.rtemsroset.*))) } > RAM |
---|
97 | .rodata1 : { *(.rodata1) } > RAM |
---|
98 | |
---|
99 | .tdata : { |
---|
100 | _TLS_Data_begin = .; |
---|
101 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
102 | _TLS_Data_end = .; |
---|
103 | } >RAM |
---|
104 | |
---|
105 | .tbss : { |
---|
106 | _TLS_BSS_begin = .; |
---|
107 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
108 | _TLS_BSS_end = .; |
---|
109 | } >RAM |
---|
110 | |
---|
111 | _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; |
---|
112 | _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; |
---|
113 | _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; |
---|
114 | _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; |
---|
115 | _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; |
---|
116 | _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); |
---|
117 | |
---|
118 | /* Initialised small data addressed as offsets from r2 */ |
---|
119 | .sdata2 : { PROVIDE (_SDA2_BASE_ = 32768); *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } > RAM |
---|
120 | |
---|
121 | /* Zeroed small data addressed as offsets from r2 */ |
---|
122 | .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) |
---|
123 | |
---|
124 | /* Avoid empty sdata2/sbss2 area: __eabi would not set up |
---|
125 | * r2 which may be important if run-time loading is used |
---|
126 | */ |
---|
127 | . += 1; |
---|
128 | |
---|
129 | PROVIDE (__SBSS2_END__ = .); |
---|
130 | } > RAM |
---|
131 | |
---|
132 | /* Exception frame info */ |
---|
133 | .eh_frame : { *(.eh_frame .eh_frame.*) } > RAM |
---|
134 | .eh_frame_hdr : { *(.eh_frame_hdr) } > RAM |
---|
135 | |
---|
136 | /* Declares where the .text section ends */ |
---|
137 | _etext = .; |
---|
138 | PROVIDE (etext = .); |
---|
139 | |
---|
140 | /* Initialized R/W Data section goes in RAM */ |
---|
141 | .data : { PROVIDE(__DATA_START__ = ABSOLUTE(.) ); |
---|
142 | *(.data) |
---|
143 | *(.data.*) |
---|
144 | KEEP (*(SORT(.rtemsrwset.*))) |
---|
145 | *(.gnu.linkonce.d*) |
---|
146 | } > RAM |
---|
147 | |
---|
148 | .data1 : { *(.data1) } > RAM |
---|
149 | |
---|
150 | PROVIDE (__EXCEPT_START__ = .); |
---|
151 | .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) } > RAM |
---|
152 | PROVIDE (__EXCEPT_END__ = .); |
---|
153 | |
---|
154 | .got1 : { *(.got1) } > RAM |
---|
155 | |
---|
156 | /* Put .ctors and .dtors next to the .got2 section, so that the pointers |
---|
157 | * get relocated with -mrelocatable. Also put in the .fixup pointers. |
---|
158 | * The current compiler no longer needs this, but keep it around for 2.7.2. |
---|
159 | */ |
---|
160 | PROVIDE (_GOT2_START_ = .); |
---|
161 | .got2 : { *(.got2) } > RAM |
---|
162 | |
---|
163 | .dynamic : { *(.dynamic) } > RAM |
---|
164 | |
---|
165 | .ctors : { /* gcc uses crtbegin.o to find the start of |
---|
166 | * the constructors, so we make sure it is |
---|
167 | * first. Because this is a wildcard, it |
---|
168 | * doesn't matter if the user does not |
---|
169 | * actually link against crtbegin.o; the |
---|
170 | * linker won't look for a file to match a |
---|
171 | * wildcard. The wildcard also means that it |
---|
172 | * doesn't matter which directory crtbegin.o |
---|
173 | * is in. |
---|
174 | */ |
---|
175 | KEEP (*crtbegin.o(.ctors)) |
---|
176 | /* We don't want to include the .ctor section from |
---|
177 | * the crtend.o file until after the sorted ctors. |
---|
178 | * The .ctor section from the crtend file contains the |
---|
179 | * end of ctors marker and it must be last. |
---|
180 | */ |
---|
181 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) |
---|
182 | KEEP (*(SORT(.ctors.*))) |
---|
183 | KEEP (*(.ctors)) |
---|
184 | } > RAM |
---|
185 | |
---|
186 | .dtors : { KEEP (*crtbegin.o(.dtors)) |
---|
187 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) |
---|
188 | KEEP (*(SORT(.dtors.*))) |
---|
189 | KEEP (*(.dtors)) |
---|
190 | } > RAM |
---|
191 | |
---|
192 | PROVIDE (_FIXUP_START_ = .); |
---|
193 | .fixup : { *(.fixup) } > RAM |
---|
194 | PROVIDE (_FIXUP_END_ = .); |
---|
195 | |
---|
196 | PROVIDE (_GOT2_END_ = .); |
---|
197 | |
---|
198 | PROVIDE (_GOT_START_ = .); |
---|
199 | .got : { __got_start = .; |
---|
200 | *(.got) |
---|
201 | } > RAM |
---|
202 | |
---|
203 | .got.plt : { *(.got.plt) } > RAM |
---|
204 | PROVIDE (_GOT_END_ = .); |
---|
205 | |
---|
206 | .jcr : { KEEP (*(.jcr)) } > RAM |
---|
207 | |
---|
208 | /* We want the small data sections together, so single-instruction offsets |
---|
209 | * can access them all, and initialized data all before uninitialized, so |
---|
210 | * we can shorten the on-disk segment size. |
---|
211 | */ |
---|
212 | /* Initialised small data addressed as offsets from r13 */ |
---|
213 | .sdata : { PROVIDE (_SDA_BASE_ = 32768); *(.sdata* .gnu.linkonce.s.*) } > RAM |
---|
214 | |
---|
215 | _edata = .; |
---|
216 | PROVIDE (edata = .); |
---|
217 | |
---|
218 | /* Zeroed small data addressed as offsets from r13 */ |
---|
219 | .sbss : { PROVIDE (__sbss_start = .); |
---|
220 | *(.dynsbss) |
---|
221 | *(.sbss*) |
---|
222 | *(.gnu.linkonce.sb.*) |
---|
223 | *(.scommon) |
---|
224 | |
---|
225 | /* Avoid empty sdata/sbss area: __eabi would not set up |
---|
226 | * r13, which may be important if run-time loading is used |
---|
227 | */ |
---|
228 | . += 1; |
---|
229 | |
---|
230 | PROVIDE (__SBSS_END__ = .); |
---|
231 | PROVIDE (__sbss_end = .); |
---|
232 | } > RAM |
---|
233 | |
---|
234 | .plt : { *(.plt) } > RAM |
---|
235 | .iplt : { *(.iplt) } > RAM |
---|
236 | |
---|
237 | /* Zeroed large data */ |
---|
238 | .bss : { PROVIDE (__bss_start = .); |
---|
239 | *(.dynbss) |
---|
240 | *(.bss) |
---|
241 | *(.bss.*) |
---|
242 | *(.gnu.linkonce.b*) |
---|
243 | *(COMMON) |
---|
244 | |
---|
245 | PROVIDE (__bss_end = ALIGN(4)); |
---|
246 | __bss_size = __bss_end - __bss_start; |
---|
247 | } > RAM |
---|
248 | |
---|
249 | __exeend = ALIGN(4); |
---|
250 | __rtems_end = .; |
---|
251 | . = ALIGN(0x20); /* Align to a cache-line boundary */ |
---|
252 | PROVIDE(__bsp_ram_start = .); |
---|
253 | |
---|
254 | /* Interrupt stack: aligned on a cache-line boundary */ |
---|
255 | . += IntrStackSize; |
---|
256 | __intrStack = .; |
---|
257 | |
---|
258 | /* Main stack lives here */ |
---|
259 | _stack = ALIGN(0x20); /* Align to a cache-line boundary */ |
---|
260 | . += StackSize; |
---|
261 | __stack_base = .; /* Initial stack builds downwards */ |
---|
262 | |
---|
263 | /* RTEMS workspace: size specified by application */ |
---|
264 | WorkAreaBase = ALIGN(0x20); /* Align to a cache-line boundary */ |
---|
265 | |
---|
266 | /* The heap comes after the work space */ |
---|
267 | |
---|
268 | . = RamBase + RamSize; |
---|
269 | PROVIDE(__bsp_ram_end = .); |
---|
270 | |
---|
271 | /* Message area for capturing early printk output */ |
---|
272 | /* Placed here to be easily findable with a debugger */ |
---|
273 | MsgAreaBase = __bsp_ram_end; |
---|
274 | . += MsgAreaSize; |
---|
275 | |
---|
276 | __phy_ram_end = .; /* True end of physical memory */ |
---|
277 | |
---|
278 | /DISCARD/ : |
---|
279 | { |
---|
280 | *(.comment) |
---|
281 | } |
---|
282 | |
---|
283 | /* Some configuration constants */ |
---|
284 | __vectors = 0; |
---|
285 | } |
---|