source: rtems/bsps/powerpc/gen5200/start/linkcmds.gen5200_base @ 33c12d5

Last change on this file since 33c12d5 was 33c12d5, checked in by Sebastian Huber <sebastian.huber@…>, on 01/25/21 at 10:19:21

bsps: Support DWARF 5 sections

GCC 11 uses DWARF 5 by default.

  • Property mode set to 100644
File size: 8.6 KB
Line 
1/**
2 * @file
3 *
4 * Derived from internal linker script of GNU ld (GNU Binutils) 2.18 for elf32ppc emulation.
5 */
6
7OUTPUT_FORMAT ("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
8OUTPUT_ARCH (powerpc)
9ENTRY (start)
10STARTUP (start.o)
11
12bsp_ram_start = ORIGIN (RAM);
13bsp_ram_end = ORIGIN (RAM) + LENGTH (RAM);
14bsp_ram_size = LENGTH (RAM);
15
16bsp_rom_start = ORIGIN (ROM);
17bsp_rom_end = ORIGIN (ROM) + LENGTH (ROM);
18bsp_rom_size = LENGTH (ROM);
19
20bsp_dpram_start = ORIGIN (DPRAM);
21bsp_dpram_end = ORIGIN (DPRAM) + LENGTH (DPRAM);
22bsp_dpram_size = LENGTH (DPRAM);
23
24bsp_section_align = 32;
25
26RamBase = bsp_ram_start;
27RamSize = bsp_ram_size;
28RamEnd = RamBase + RamSize;
29HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
30
31/*
32 * The upper layer linker command file may optionally define the symbol
33 * bsp_section_small_data_area_size.  By default, the small data area is
34 * defined by the .sdata and .sbss input sections.  Define
35 * bsp_section_small_data_area_size, if you want to make space available for
36 * dynamically loaded libraries (libdl).  Small memory targets which do not use
37 * libdl, should not define this symbol.
38 */
39
40MEMORY {
41        UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0
42}
43
44SECTIONS {
45        /*
46         * BSP: MPC5200 registers
47         */
48        .regs (NOLOAD) : {
49                MBAR = .;
50                mpc5200 = .;
51        } > REGS
52
53        /*
54         * BSP: Exception vectors
55         */
56        .vectors 0x100 : {
57                *(.vectors)
58        } > RAM
59
60        /*
61         * BSP: The initial stack will live in this area - between the vectors
62         * and the text section.
63         */
64
65        .text 0x10000 : {
66                /*
67                 * BSP: Start of text section
68                 */
69                bsp_section_text_start = .;
70
71                /*
72                 * BSP: System startup entry
73                 */
74                KEEP (*(.entry))
75
76                /*
77                 * BSP: Moved into .text from .init
78                 */
79                KEEP (*(.init))
80
81                *(.text .stub .text.* .gnu.linkonce.t.*)
82                KEEP (*(.text.*personality*))
83                /* .gnu.warning sections are handled specially by elf32.em.  */
84                *(.gnu.warning)
85                *(.glink)
86               
87                /*
88                 * BSP: Special FreeBSD sysctl sections
89                 */
90                . = ALIGN (16);
91                __start_set_sysctl_set = .;
92                *(set_sysctl_*);
93                __stop_set_sysctl_set = ABSOLUTE(.);
94                *(set_domain_*);
95                *(set_pseudo_*);
96
97                /*
98                 * BSP: Moved into .text from .*
99                 */
100                *(.rodata .rodata.* .gnu.linkonce.r.*)
101                KEEP (*(SORT(.rtemsroset.*)))
102                *(.rodata1)
103                *(.interp)
104                *(.note.gnu.build-id)
105                *(.hash)
106                *(.gnu.hash)
107                *(.dynsym)
108                *(.dynstr)
109                *(.gnu.version)
110                *(.gnu.version_d)
111                *(.gnu.version_r)
112                *(.eh_frame_hdr)
113
114                /*
115                 * BSP: Magic PPC stuff
116                 */
117                *(.PPC.*)
118
119                /*
120                 * BSP: Required by cpukit/score/src/threadhandler.c
121                 */
122                PROVIDE (_fini = .);
123
124                /*
125                 * BSP: Moved into .text from .fini
126                 */
127                KEEP (*(.fini))
128
129                . = ALIGN (bsp_section_align);
130
131                PROVIDE (__etext = .);
132                PROVIDE (_etext = .);
133                PROVIDE (etext = .);
134        } > RAM
135
136        .tdata : {
137                _TLS_Data_begin = .;
138                *(.tdata .tdata.* .gnu.linkonce.td.*)
139                _TLS_Data_end = .;
140        } > RAM
141        .tbss : {
142                _TLS_BSS_begin = .;
143                *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
144                _TLS_BSS_end = .;
145        } > RAM
146        _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
147        _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
148        _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
149        _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
150        _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
151        _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
152
153        .sdata2 : {
154                PROVIDE (_SDA2_BASE_ = 32768);
155
156                *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
157
158                . = ALIGN (bsp_section_align);
159        } > RAM
160
161        .sbss2 : {
162                *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
163
164                . = ALIGN (bsp_section_align);
165
166                /*
167                 * BSP: End of text section
168                 */
169                bsp_section_text_end = .;
170        } > RAM
171
172        .data : {
173                /*
174                 * BSP: Start of data section
175                 */
176                bsp_section_data_start = .;
177
178                /*
179                 * BSP: Moved into .data from .ctors
180                 */
181                KEEP (*ecrti.o(.ctors))
182                KEEP (*crtbegin.o(.ctors))
183                KEEP (*crtbegin?.o(.ctors))
184                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .ctors))
185                KEEP (*(SORT(.ctors.*)))
186                KEEP (*(.ctors))
187
188                /*
189                 * BSP: Moved into .data from .dtors
190                 */
191                KEEP (*ecrti.o(.dtors))
192                KEEP (*crtbegin.o(.dtors))
193                KEEP (*crtbegin?.o(.dtors))
194                KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
195                KEEP (*(SORT(.dtors.*)))
196                KEEP (*(.dtors))
197
198                /*
199                 * BSP: Moved into .data from .*
200                 */
201                *(.tdata .tdata.* .gnu.linkonce.td.*)
202                *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
203                *(.data1)
204                KEEP (*(.eh_frame))
205                *(.gcc_except_table .gcc_except_table.*)
206                KEEP (*(.jcr))
207                *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
208                *(.fixup)
209                *(.got1)
210                *(.got2)
211                *(.dynamic)
212                *(.got)
213                *(.plt)
214                PROVIDE_HIDDEN (__preinit_array_start = .);
215                KEEP (*(.preinit_array))
216                PROVIDE_HIDDEN (__preinit_array_end = .);
217                PROVIDE_HIDDEN (__init_array_start = .);
218                KEEP (*(SORT(.init_array.*)))
219                KEEP (*(.init_array))
220                PROVIDE_HIDDEN (__init_array_end = .);
221                PROVIDE_HIDDEN (__fini_array_start = .);
222                KEEP (*(.fini_array))
223                KEEP (*(SORT(.fini_array.*)))
224                PROVIDE_HIDDEN (__fini_array_end = .);
225
226                *(.data .data.* .gnu.linkonce.d.*)
227                KEEP (*(SORT(.rtemsrwset.*)))
228                KEEP (*(.gnu.linkonce.d.*personality*))
229                SORT(CONSTRUCTORS)
230
231                . = ALIGN (bsp_section_align);
232        } > RAM
233
234        .sdata : {
235                bsp_section_sdata_begin = .;
236                PROVIDE (_SDA_BASE_ = 32768);
237                *(.sdata .sdata.* .gnu.linkonce.s.*)
238
239                . = ALIGN (bsp_section_align);
240
241                _edata = .;
242                PROVIDE (edata = .);
243
244                /*
245                 * BSP: End of data section
246                 */
247                bsp_section_data_end = .;
248                bsp_section_sdata_end = .;
249        } > RAM
250
251        .sbss : {
252                /*
253                 * BSP: Start of bss section
254                 */
255                bsp_section_sbss_begin = .;
256
257                __bss_start = .;
258
259                PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
260                *(.scommon)
261                *(.dynsbss)
262                *(.sbss .sbss.* .gnu.linkonce.sb.*)
263                PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
264                bsp_section_sbss_end = .;
265                bsp_section_sdata_libdl_begin = .;
266                . = DEFINED(bsp_section_small_data_area_size) ?
267                      bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
268                bsp_section_sdata_libdl_end = .;
269
270                . = ALIGN (bsp_section_align);
271        } > RAM
272
273        .bss : {
274                bsp_section_bss_start = .;
275                *(COMMON)
276                *(.dynbss)
277                *(.bss .bss.* .gnu.linkonce.b.*)
278
279                . = ALIGN (bsp_section_align);
280
281                __end = .;
282                _end = .;
283                PROVIDE (end = .);
284
285                /*
286                 * BSP: End of bss section
287                 */
288                bsp_section_bss_end = .;
289        } > RAM
290
291        /*
292         * BSP: Section sizes
293         */
294        bsp_section_text_size = bsp_section_text_end - bsp_section_text_start;
295        bsp_section_data_size = bsp_section_data_end - bsp_section_data_start;
296        bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_start;
297
298        .rtemsstack (NOLOAD) : {
299                *(SORT(.rtemsstack.*))
300        } > RAM
301
302        /*
303         * BSP: Work area start
304         */
305        bsp_work_area_start = .;
306        WorkAreaBase = bsp_work_area_start;
307       
308        /* Stabs debugging sections.  */
309        .stab          0 : { *(.stab) }
310        .stabstr       0 : { *(.stabstr) }
311        .stab.excl     0 : { *(.stab.excl) }
312        .stab.exclstr  0 : { *(.stab.exclstr) }
313        .stab.index    0 : { *(.stab.index) }
314        .stab.indexstr 0 : { *(.stab.indexstr) }
315        .comment       0 : { *(.comment) }
316        /* DWARF debug sections.
317           Symbols in the DWARF debugging sections are relative to the beginning
318           of the section so we begin them at 0.  */
319        /* DWARF 1.  */
320        .debug          0 : { *(.debug) }
321        .line           0 : { *(.line) }
322        /* GNU DWARF 1 extensions.  */
323        .debug_srcinfo  0 : { *(.debug_srcinfo) }
324        .debug_sfnames  0 : { *(.debug_sfnames) }
325        /* DWARF 1.1 and DWARF 2.  */
326        .debug_aranges  0 : { *(.debug_aranges) }
327        .debug_pubnames 0 : { *(.debug_pubnames) }
328        /* DWARF 2.  */
329        .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
330        .debug_abbrev   0 : { *(.debug_abbrev) }
331        .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end) }
332        .debug_frame    0 : { *(.debug_frame) }
333        .debug_str      0 : { *(.debug_str) }
334        .debug_loc      0 : { *(.debug_loc) }
335        .debug_macinfo  0 : { *(.debug_macinfo) }
336        /* SGI/MIPS DWARF 2 extensions.  */
337        .debug_weaknames 0 : { *(.debug_weaknames) }
338        .debug_funcnames 0 : { *(.debug_funcnames) }
339        .debug_typenames 0 : { *(.debug_typenames) }
340        .debug_varnames  0 : { *(.debug_varnames) }
341        /* DWARF 3.  */
342        .debug_pubtypes 0 : { *(.debug_pubtypes) }
343        .debug_ranges   0 : { *(.debug_ranges) }
344        /* DWARF 5.  */
345        .debug_loclists 0 : { *(.debug_loclists) }
346        .debug_rnglists 0 : { *(.debug_rnglists) }
347        .debug_line_str 0 : { *(.debug_line_str) }
348        .debug_str_offsets 0 : { *(.debug_str_offsets) }
349        .debug_macro    0 : { *(.debug_macro) }
350        .debug_addr     0 : { *(.debug_addr) }
351        .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
352
353        /DISCARD/ : {
354                *(.note.GNU-stack) *(.gnu_debuglink)
355        }
356
357        /*
358         * This is a RTEMS specific section to catch all unexpected input
359         * sections.  In case you get an error like
360         *   "section `.unexpected_sections' will not fit in region
361         *   `UNEXPECTED_SECTIONS'"
362         * you have to figure out the offending input section and add it to the
363         * appropriate output section definition above.
364         */
365        .unexpected_sections : { *(*) } > UNEXPECTED_SECTIONS
366}
Note: See TracBrowser for help on using the repository browser.