1 | /* |
---|
2 | * The common part of the default linker scripts for standalone executables |
---|
3 | * running on single core Blackfin processors. |
---|
4 | * |
---|
5 | * Copyright (C) 2008 Analog Devices, Inc. |
---|
6 | * |
---|
7 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
8 | * and license this software and its documentation for any purpose, provided |
---|
9 | * that existing copyright notices are retained in all copies and that this |
---|
10 | * notice is included verbatim in any distributions. No written agreement, |
---|
11 | * license, or royalty fee is required for any of the authorized uses. |
---|
12 | * Modifications to this software may be copyrighted by their authors |
---|
13 | * and need not follow the licensing terms described here, provided that |
---|
14 | * the new terms are clearly indicated on the first page of each file where |
---|
15 | * they apply. |
---|
16 | */ |
---|
17 | |
---|
18 | /* The default linker script, for single core blackfin standalone executables */ |
---|
19 | OUTPUT_FORMAT("elf32-bfin", "elf32-bfin", |
---|
20 | "elf32-bfin") |
---|
21 | OUTPUT_ARCH(bfin) |
---|
22 | ENTRY(__start) |
---|
23 | |
---|
24 | SECTIONS |
---|
25 | { |
---|
26 | /* Read-only sections, merged into text segment: */ |
---|
27 | PROVIDE (__executable_start = 0x0); . = 0x0; |
---|
28 | .interp : { *(.interp) } |
---|
29 | .hash : { *(.hash) } |
---|
30 | .dynsym : { *(.dynsym) } |
---|
31 | .dynstr : { *(.dynstr) } |
---|
32 | .gnu.version : { *(.gnu.version) } |
---|
33 | .gnu.version_d : { *(.gnu.version_d) } |
---|
34 | .gnu.version_r : { *(.gnu.version_r) } |
---|
35 | .rel.init : { *(.rel.init) } |
---|
36 | .rela.init : { *(.rela.init) } |
---|
37 | .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } |
---|
38 | .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } |
---|
39 | .rel.fini : { *(.rel.fini) } |
---|
40 | .rela.fini : { *(.rela.fini) } |
---|
41 | .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } |
---|
42 | .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } |
---|
43 | .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } |
---|
44 | .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } |
---|
45 | .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } |
---|
46 | .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } |
---|
47 | .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } |
---|
48 | .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } |
---|
49 | .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } |
---|
50 | .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } |
---|
51 | .rel.ctors : { *(.rel.ctors) } |
---|
52 | .rela.ctors : { *(.rela.ctors) } |
---|
53 | .rel.dtors : { *(.rel.dtors) } |
---|
54 | .rela.dtors : { *(.rela.dtors) } |
---|
55 | .rel.got : { *(.rel.got) } |
---|
56 | .rela.got : { *(.rela.got) } |
---|
57 | .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } |
---|
58 | .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } |
---|
59 | .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } |
---|
60 | .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } |
---|
61 | .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } |
---|
62 | .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } |
---|
63 | .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } |
---|
64 | .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } |
---|
65 | .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } |
---|
66 | .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } |
---|
67 | .rel.plt : { *(.rel.plt) } |
---|
68 | .rela.plt : { *(.rela.plt) } |
---|
69 | .l2 : |
---|
70 | { |
---|
71 | *(.l2 .l2.*) |
---|
72 | } >MEM_L2 =0 |
---|
73 | .l2_shared : |
---|
74 | { |
---|
75 | *(.l2_shared .l2_shared.*) |
---|
76 | } >MEM_L2_SHARED =0 |
---|
77 | .1.text : |
---|
78 | { |
---|
79 | *(.1.text .1.text.* .1.l1.text .1.l1.text.*) |
---|
80 | } >MEM_C1_L1_CODE =0 |
---|
81 | .text : |
---|
82 | { |
---|
83 | *(.text .stub .text.* .gnu.linkonce.t.* .l1.text .l1.text.*) |
---|
84 | KEEP (*(.text.*personality*)) |
---|
85 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
86 | *(.gnu.warning) |
---|
87 | } >MEM_L1_CODE =0 |
---|
88 | .init : |
---|
89 | { |
---|
90 | KEEP (*(.init)) |
---|
91 | } >MEM_L1_CODE =0 |
---|
92 | .plt : { *(.plt) } >MEM_L1_CODE |
---|
93 | .fini : |
---|
94 | { |
---|
95 | KEEP (*(.fini)) |
---|
96 | } >MEM_L1_CODE =0 |
---|
97 | PROVIDE (__etext = .); |
---|
98 | PROVIDE (_etext = .); |
---|
99 | PROVIDE (etext = .); |
---|
100 | .1.rodata : { *(.1.rodata .1.rodata.*) } >MEM_C1_L1_DATA_A |
---|
101 | .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } >MEM_L1_DATA_A |
---|
102 | .rodata1 : { *(.rodata1) } >MEM_L1_DATA_A |
---|
103 | .sdata2 : |
---|
104 | { |
---|
105 | *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) |
---|
106 | } >MEM_L1_DATA_A |
---|
107 | .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } >MEM_L1_DATA_A |
---|
108 | .eh_frame_hdr : { *(.eh_frame_hdr) } >MEM_L1_DATA_A |
---|
109 | .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } >MEM_L1_DATA_A |
---|
110 | .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } >MEM_L1_DATA_A |
---|
111 | /* Adjust the address for the data segment. We want to adjust up to |
---|
112 | the same address within the page on the next page up. */ |
---|
113 | . = ALIGN(0x1000) + (. & (0x1000 - 1)); |
---|
114 | /* Exception handling */ |
---|
115 | .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } >MEM_L1_DATA_A |
---|
116 | .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } >MEM_L1_DATA_A |
---|
117 | /* Thread Local Storage sections */ |
---|
118 | .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } >MEM_L1_DATA_A |
---|
119 | .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } >MEM_L1_DATA_A |
---|
120 | .preinit_array : |
---|
121 | { |
---|
122 | PROVIDE_HIDDEN (___preinit_array_start = .); |
---|
123 | KEEP (*(.preinit_array)) |
---|
124 | PROVIDE_HIDDEN (___preinit_array_end = .); |
---|
125 | } >MEM_L1_DATA_A |
---|
126 | .init_array : |
---|
127 | { |
---|
128 | PROVIDE_HIDDEN (___init_array_start = .); |
---|
129 | KEEP (*(SORT(.init_array.*))) |
---|
130 | KEEP (*(.init_array)) |
---|
131 | PROVIDE_HIDDEN (___init_array_end = .); |
---|
132 | } >MEM_L1_DATA_A |
---|
133 | .fini_array : |
---|
134 | { |
---|
135 | PROVIDE_HIDDEN (___fini_array_start = .); |
---|
136 | KEEP (*(.fini_array)) |
---|
137 | KEEP (*(SORT(.fini_array.*))) |
---|
138 | PROVIDE_HIDDEN (___fini_array_end = .); |
---|
139 | } >MEM_L1_DATA_A |
---|
140 | .ctors : |
---|
141 | { |
---|
142 | /* gcc uses crtbegin.o to find the start of |
---|
143 | the constructors, so we make sure it is |
---|
144 | first. Because this is a wildcard, it |
---|
145 | doesn't matter if the user does not |
---|
146 | actually link against crtbegin.o; the |
---|
147 | linker won't look for a file to match a |
---|
148 | wildcard. The wildcard also means that it |
---|
149 | doesn't matter which directory crtbegin.o |
---|
150 | is in. */ |
---|
151 | KEEP (*crtbegin*.o(.ctors)) |
---|
152 | /* We don't want to include the .ctor section from |
---|
153 | the crtend.o file until after the sorted ctors. |
---|
154 | The .ctor section from the crtend file contains the |
---|
155 | end of ctors marker and it must be last */ |
---|
156 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) |
---|
157 | KEEP (*(SORT(.ctors.*))) |
---|
158 | KEEP (*(.ctors)) |
---|
159 | } >MEM_L1_DATA_A |
---|
160 | .dtors : |
---|
161 | { |
---|
162 | KEEP (*crtbegin*.o(.dtors)) |
---|
163 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) |
---|
164 | KEEP (*(SORT(.dtors.*))) |
---|
165 | KEEP (*(.dtors)) |
---|
166 | } >MEM_L1_DATA_A |
---|
167 | .jcr : { KEEP (*(.jcr)) } >MEM_L1_DATA_A |
---|
168 | .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } >MEM_L1_DATA_A |
---|
169 | .dynamic : { *(.dynamic) } >MEM_L1_DATA_A |
---|
170 | .1.data : |
---|
171 | { |
---|
172 | *(.1.data .1.data.* .1.l1.data .1.l1.data.*) |
---|
173 | } >MEM_C1_L1_DATA_A |
---|
174 | .data : |
---|
175 | { |
---|
176 | *(.data .data.* .gnu.linkonce.d.* .l1.data .l1.data.*) |
---|
177 | KEEP (*(.gnu.linkonce.d.*personality*)) |
---|
178 | SORT(CONSTRUCTORS) |
---|
179 | } >MEM_L1_DATA_A |
---|
180 | .data1 : { *(.data1) } >MEM_L1_DATA_A |
---|
181 | .got : { *(.got.plt) *(.got) } >MEM_L1_DATA_A |
---|
182 | /* We want the small data sections together, so single-instruction offsets |
---|
183 | can access them all, and initialized data all before uninitialized, so |
---|
184 | we can shorten the on-disk segment size. */ |
---|
185 | .sdata : |
---|
186 | { |
---|
187 | *(.sdata .sdata.* .gnu.linkonce.s.*) |
---|
188 | } >MEM_L1_DATA_A |
---|
189 | __edata = .; PROVIDE (_edata = .); |
---|
190 | .1.sbss : |
---|
191 | { |
---|
192 | __core1_bss_start = .; |
---|
193 | } >MEM_C1_L1_DATA_A |
---|
194 | .1.bss : |
---|
195 | { |
---|
196 | *(.1.bss .1.bss.*) |
---|
197 | __core1_bss_end = .; |
---|
198 | } >MEM_C1_L1_DATA_A |
---|
199 | .sbss : |
---|
200 | { |
---|
201 | __bss_start = .; |
---|
202 | *(.dynsbss) |
---|
203 | *(.sbss .sbss.* .gnu.linkonce.sb.*) |
---|
204 | *(.scommon) |
---|
205 | } >MEM_L1_DATA_A |
---|
206 | .bss : |
---|
207 | { |
---|
208 | *(.dynbss) |
---|
209 | *(.bss .bss.* .gnu.linkonce.1.*) |
---|
210 | *(COMMON) |
---|
211 | /* Align here to ensure that the .bss section occupies space up to |
---|
212 | _end. Align after .bss to ensure correct alignment even if the |
---|
213 | .bss section disappears because there are no input sections. |
---|
214 | FIXME: Why do we need it? When there is no .bss section, we don't |
---|
215 | pad the .data section. */ |
---|
216 | . = ALIGN(. != 0 ? 32 / 8 : 1); |
---|
217 | __bss_end = .; |
---|
218 | } >MEM_L1_DATA_A |
---|
219 | . = ALIGN(32 / 8); |
---|
220 | . = ALIGN(32 / 8); |
---|
221 | __end = .; PROVIDE (_end = .); |
---|
222 | /* Stabs debugging sections. */ |
---|
223 | .stab 0 : { *(.stab) } |
---|
224 | .stabstr 0 : { *(.stabstr) } |
---|
225 | .stab.excl 0 : { *(.stab.excl) } |
---|
226 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
227 | .stab.index 0 : { *(.stab.index) } |
---|
228 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
229 | .comment 0 : { *(.comment) } |
---|
230 | /* DWARF debug sections. |
---|
231 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
232 | of the section so we begin them at 0. */ |
---|
233 | /* DWARF 1 */ |
---|
234 | .debug 0 : { *(.debug) } |
---|
235 | .line 0 : { *(.line) } |
---|
236 | /* GNU DWARF 1 extensions */ |
---|
237 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
238 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
239 | /* DWARF 1.1 and DWARF 2 */ |
---|
240 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
241 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
242 | /* DWARF 2 */ |
---|
243 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
---|
244 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
245 | .debug_line 0 : { *(.debug_line) } |
---|
246 | .debug_frame 0 : { *(.debug_frame) } |
---|
247 | .debug_str 0 : { *(.debug_str) } |
---|
248 | .debug_loc 0 : { *(.debug_loc) } |
---|
249 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
250 | /* SGI/MIPS DWARF 2 extensions */ |
---|
251 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
252 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
253 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
254 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
255 | |
---|
256 | __stack_end = ORIGIN(MEM_L1_SCRATCH) + LENGTH(MEM_L1_SCRATCH); |
---|
257 | __core1_stack_end = ORIGIN(MEM_C1_L1_SCRATCH) + LENGTH(MEM_C1_L1_SCRATCH); |
---|
258 | |
---|
259 | /DISCARD/ : { *(.note.GNU-stack) } |
---|
260 | } |
---|