source: rtems/bsps/powerpc/shared/start/linkcmds.share @ f6895c6

Last change on this file since f6895c6 was f6895c6, checked in by Sebastian Huber <sebastian.huber@…>, on May 7, 2019 at 8:16:46 AM

bsps/powerpc: Fix C++ exception handling

Close #3736.

  • Property mode set to 100644
File size: 10.6 KB
Line 
1OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
2              "elf32-powerpc")
3OUTPUT_ARCH(powerpc)
4
5/* Do we need any of these for elf?
6   __DYNAMIC = 0;    */
7MEMORY {
8        VECTORS : ORIGIN = 0x0 ,  LENGTH = 0x3000
9        CODE : ORIGIN = 0x3000 , LENGTH = 32M - 0x3000
10}
11
12/*
13 * The upper layer linker command file may optionally define the symbol
14 * bsp_section_small_data_area_size.  By default, the small data area is
15 * defined by the .sdata and .sbss input sections.  Define
16 * bsp_section_small_data_area_size, if you want to make space available for
17 * dynamically loaded libraries (libdl).  Small memory targets which do not use
18 * libdl, should not define this symbol.
19 */
20
21SECTIONS
22{
23  .entry_point_section :
24  {
25        KEEP(*(.entry_point_section))
26  } > VECTORS
27
28  /*
29   * This section is used only if NO_DYNAMIC_EXCEPTION_VECTOR_INSTALL
30   * is defined in vectors/vectors.S
31   */
32  .vectors :
33  {
34    *(.vectors)
35  } > VECTORS
36
37  /* Read-only sections, merged into text segment: */
38  .interp   : { *(.interp) }    > CODE
39  .hash           : { *(.hash)          }       > CODE
40  .dynsym         : { *(.dynsym)                }       > CODE
41  .dynstr         : { *(.dynstr)                }       > CODE
42  .gnu.version   : { *(.gnu.version)      }     > CODE
43  .gnu.version_d   : { *(.gnu.version_d)  }     > CODE
44  .gnu.version_r   : { *(.gnu.version_r)  }     > CODE
45  .rela.text     :
46    { *(.rela.text) *(.rela.gnu.linkonce.t*) }  > CODE
47  .rela.data     :
48    { *(.rela.data) *(.rela.gnu.linkonce.d*) }  > CODE
49  .rela.rodata   :
50    { *(.rela.rodata*) *(.rela.gnu.linkonce.r*) }       > CODE
51  .rela.got       : { *(.rela.got)      }       > CODE
52  .rela.got1      : { *(.rela.got1)     }       > CODE
53  .rela.got2      : { *(.rela.got2)     }       > CODE
54  .rela.ctors     : { *(.rela.ctors)    }       > CODE
55  .rela.dtors     : { *(.rela.dtors)    }       > CODE
56  .rela.init      : { *(.rela.init)     }       > CODE
57  .rela.fini      : { *(.rela.fini)     }       > CODE
58  .rela.bss       : { *(.rela.bss)      }       > CODE
59  .rela.plt       : { *(.rela.plt)      }       > CODE
60  .rela.sdata     : { *(.rela.sdata)    }       > CODE
61  .rela.sbss      : { *(.rela.sbss)     }       > CODE
62  .rela.sdata2    : { *(.rela.sdata2)   }       > CODE
63  .rela.sbss2     : { *(.rela.sbss2)    }       > CODE
64  .rela.dyn       : { *(.rela.dyn)      }       > CODE
65
66  .init           : { KEEP(*(.init))            } > CODE
67
68  .text      : 
69  {
70    *(.text*)   
71
72    /*
73     * Special FreeBSD sysctl sections.
74     */
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    *(.gnu.warning)
84    *(.gnu.linkonce.t*)
85  }  > CODE
86
87  .fini           : { _fini = .; KEEP(*(.fini)) } > CODE
88
89  .rodata         : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) }   > CODE
90  .rodata1        : { *(.rodata1) }     > CODE
91
92  .tdata : {
93    _TLS_Data_begin = .;
94    *(.tdata .tdata.* .gnu.linkonce.td.*)
95    _TLS_Data_end = .;
96  } >CODE
97
98  .tbss : {
99    _TLS_BSS_begin = .;
100    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
101    _TLS_BSS_end = .;
102  } >CODE
103
104  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
105  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
106  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
107  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
108  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
109  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
110
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(0x10000) + (. & (0x10000 - 1));
114  /* Ensure the __preinit_array_start label is properly aligned.  We
115     could instead move the label definition inside the section, but
116     the linker would then create the section even if it turns out to
117     be empty, which isn't pretty.  */
118  . = ALIGN(32 / 8);
119  PROVIDE (__preinit_array_start = .);
120  .preinit_array     : { *(.preinit_array) } >CODE
121  PROVIDE (__preinit_array_end = .);
122  PROVIDE (__init_array_start = .);
123  .init_array     : { *(.init_array) } >CODE
124  PROVIDE (__init_array_end = .);
125  PROVIDE (__fini_array_start = .);
126  .fini_array     : { *(.fini_array) } >CODE
127  PROVIDE (__fini_array_end = .);
128
129  .sdata2         : {PROVIDE (_SDA2_BASE_ = 32768); *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } >CODE
130  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
131                        /* avoid empty sdata2/sbss2 area -- __eabi would not set up r2
132                         * which may be important if run-time loading is used
133                         */
134                     . += 1;
135                     PROVIDE (__SBSS2_END__ = .);
136                    } >CODE
137  .eh_frame_hdr   : { *(.eh_frame_hdr)                  } >CODE
138  .eh_frame       : { KEEP (*(.eh_frame))               } >CODE
139
140  /* NOTE: if the BSP uses page tables, the correctness of
141   *       '_etext' (and __DATA_START__) is CRUCIAL - otherwise,
142   *       an invalid mapping may result!!!
143   */
144  _etext = .;
145  PROVIDE (etext = .);
146
147  /* Adjust the address for the data segment.  We want to adjust up to
148     the same address within the page on the next page up.  It would
149     be more correct to do this:
150       . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1));
151     The current expression does not correctly handle the case of a
152     text segment ending precisely at the end of a page; it causes the
153     data segment to skip a page.  The above expression does not have
154     this problem, but it will currently (2/95) cause BFD to allocate
155     a single segment, combining both text and data, for this case.
156     This will prevent the text segment from being shared among
157     multiple executions of the program; I think that is more
158     important than losing a page of the virtual address space (note
159     that no actual memory is lost; the page which is skipped can not
160     be referenced).  */
161  . = ALIGN(0x1000);
162 .data ALIGN(0x1000) :
163  {
164   /* NOTE: if the BSP uses page tables, the correctness of
165    *       '__DATA_START__' (and _etext) is CRUCIAL - otherwise,
166    *       an invalid mapping may result!!!
167    */
168        PROVIDE(__DATA_START__ = ABSOLUTE(.) );
169    *(.data .data.* .gnu.linkonce.d*)   
170    KEEP (*(SORT(.rtemsrwset.*)))
171    SORT(CONSTRUCTORS)
172  } > CODE
173  .data1   : { *(.data1) }      > CODE
174  PROVIDE (__EXCEPT_START__ = .);
175  .gcc_except_table   : { *(.gcc_except_table .gcc_except_table.*) } > CODE
176  PROVIDE (__EXCEPT_END__ = .);
177  .got1           : { *(.got1) }        > CODE
178  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
179     get relocated with -mrelocatable. Also put in the .fixup pointers.
180     The current compiler no longer needs this, but keep it around for 2.7.2  */
181                PROVIDE (_GOT2_START_ = .);
182  .got2           :  { *(.got2) }       > CODE
183  .dynamic        : { *(.dynamic) }     > CODE
184
185  .ctors          :
186  {
187    /* gcc uses crtbegin.o to find the start of
188       the constructors, so we make sure it is
189       first.  Because this is a wildcard, it
190       doesn't matter if the user does not
191       actually link against crtbegin.o; the
192       linker won't look for a file to match a
193       wildcard.  The wildcard also means that it
194       doesn't matter which directory crtbegin.o
195       is in.  */
196    KEEP (*crtbegin.o(.ctors))
197    /* We don't want to include the .ctor section from
198       from the crtend.o file until after the sorted ctors.
199       The .ctor section from the crtend file contains the
200       end of ctors marker and it must be last */
201    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
202    KEEP (*(SORT(.ctors.*)))
203    KEEP (*(.ctors))
204  } > CODE
205  .dtors          :
206  {
207    KEEP (*crtbegin.o(.dtors))
208    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
209    KEEP (*(SORT(.dtors.*)))
210    KEEP (*(.dtors))
211  } > CODE
212
213
214                PROVIDE (_FIXUP_START_ = .);
215  .fixup          : { *(.fixup) }       > CODE
216                PROVIDE (_FIXUP_END_ = .);
217                PROVIDE (_GOT2_END_ = .);
218                PROVIDE (_GOT_START_ = .);
219
220  .got            : { *(.got) } > CODE
221  .got.plt        : { *(.got.plt) }     > CODE
222
223                PROVIDE (_GOT_END_ = .);
224
225  .jcr            : { KEEP (*(.jcr)) } > CODE
226
227  /* We want the small data sections together, so single-instruction offsets
228     can access them all, and initialized data all before uninitialized, so
229     we can shorten the on-disk segment size.  */
230  .sdata : {
231    bsp_section_sdata_begin = .;
232    PROVIDE (_SDA_BASE_ = 32768);
233    *(.sdata*) *(.gnu.linkonce.s.*)
234    bsp_section_sdata_end = .;
235  } > CODE
236  _edata  =  .;
237  PROVIDE (edata = .);
238  .sbss      :
239  {
240    bsp_section_sbss_begin = .;
241    PROVIDE (__sbss_start = .);
242    *(.dynsbss)
243    *(.sbss* .gnu.linkonce.sb.*)
244    *(.scommon)
245    /* avoid empty sdata/sbss area -- __eabi would not set up r13
246     * which may be important if run-time loading is used
247     */
248    . += 1;
249    PROVIDE (__SBSS_END__ = .);
250    PROVIDE (__sbss_end = .);
251    bsp_section_sbss_end = .;
252    bsp_section_sdata_libdl_begin = .;
253     . = DEFINED(bsp_section_small_data_area_size) ?
254         bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
255    bsp_section_sdata_libdl_end = .;
256  } > CODE
257  .plt   : { *(.plt) }  > CODE
258  .bss       :
259  {
260   PROVIDE (__bss_start = .);
261   *(.dynbss)
262   *(.bss .bss* .gnu.linkonce.b*)
263   *(COMMON)
264  . = ALIGN(16);
265   PROVIDE (__bss_end = .);
266  } > CODE
267  .rtemsstack (NOLOAD) : {
268    *(SORT(.rtemsstack.*))
269  } >CODE
270  . = ALIGN(16);
271  _end = . ;
272  __rtems_end = . ;
273  PROVIDE (end = .);
274  /DISCARD/ :
275  {
276    *(.comment)
277  }
278
279
280  /* Stabs debugging sections.  */
281  .stab 0 : { *(.stab) }
282  .stabstr 0 : { *(.stabstr) }
283  .stab.excl 0 : { *(.stab.excl) }
284  .stab.exclstr 0 : { *(.stab.exclstr) }
285  .stab.index 0 : { *(.stab.index) }
286  .stab.indexstr 0 : { *(.stab.indexstr) }
287  .comment 0 : { *(.comment) }
288
289  /* DWARF debug sections.
290     Symbols in the DWARF debugging sections are relative to the beginning
291     of the section so we begin them at 0.  */
292  /* DWARF 1 */
293  .debug          0 : { *(.debug) }
294  .line           0 : { *(.line) }
295 
296  /* GNU DWARF 1 extensions */
297  .debug_srcinfo  0 : { *(.debug_srcinfo) }
298  .debug_sfnames  0 : { *(.debug_sfnames) }
299 
300  /* DWARF 1.1 and DWARF 2 */
301  .debug_aranges  0 : { *(.debug_aranges) }
302  .debug_pubnames 0 : { *(.debug_pubnames) }
303 
304  /* DWARF 2 */
305  .debug_info     0 : { *(.debug_info) }
306  .debug_abbrev   0 : { *(.debug_abbrev) }
307  .debug_line     0 : { *(.debug_line) }
308  .debug_frame    0 : { *(.debug_frame) }
309  .debug_str      0 : { *(.debug_str) }
310  .debug_loc      0 : { *(.debug_loc) }
311  .debug_macinfo  0 : { *(.debug_macinfo) }
312 
313  /* SGI/MIPS DWARF 2 extensions */
314  .debug_weaknames 0 : { *(.debug_weaknames) }
315  .debug_funcnames 0 : { *(.debug_funcnames) }
316  .debug_typenames 0 : { *(.debug_typenames) }
317  .debug_varnames  0 : { *(.debug_varnames) }
318  /* These must appear regardless of  .  */
319}
Note: See TracBrowser for help on using the repository browser.