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

5
Last change on this file since 7bd38f8 was 30d61a6, checked in by Sebastian Huber <sebastian.huber@…>, on 05/07/19 at 08:17:49

bsps/powerpc: Fix constructors with priority

Update #3339.

  • Property mode set to 100644
File size: 10.2 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    KEEP (*ecrti.o(.ctors))
187    KEEP (*crtbegin.o(.ctors))
188    KEEP (*crtbegin?.o(.ctors))
189    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .ctors))
190    KEEP (*(SORT(.ctors.*)))
191    KEEP (*(.ctors))
192  } > CODE
193  .dtors          : {
194    KEEP (*ecrti.o(.dtors))
195    KEEP (*crtbegin.o(.dtors))
196    KEEP (*crtbegin?.o(.dtors))
197    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
198    KEEP (*(SORT(.dtors.*)))
199    KEEP (*(.dtors))
200  } > CODE
201
202
203                PROVIDE (_FIXUP_START_ = .);
204  .fixup          : { *(.fixup) }       > CODE
205                PROVIDE (_FIXUP_END_ = .);
206                PROVIDE (_GOT2_END_ = .);
207                PROVIDE (_GOT_START_ = .);
208
209  .got            : { *(.got) } > CODE
210  .got.plt        : { *(.got.plt) }     > CODE
211
212                PROVIDE (_GOT_END_ = .);
213
214  .jcr            : { KEEP (*(.jcr)) } > CODE
215
216  /* We want the small data sections together, so single-instruction offsets
217     can access them all, and initialized data all before uninitialized, so
218     we can shorten the on-disk segment size.  */
219  .sdata : {
220    bsp_section_sdata_begin = .;
221    PROVIDE (_SDA_BASE_ = 32768);
222    *(.sdata*) *(.gnu.linkonce.s.*)
223    bsp_section_sdata_end = .;
224  } > CODE
225  _edata  =  .;
226  PROVIDE (edata = .);
227  .sbss      :
228  {
229    bsp_section_sbss_begin = .;
230    PROVIDE (__sbss_start = .);
231    *(.dynsbss)
232    *(.sbss* .gnu.linkonce.sb.*)
233    *(.scommon)
234    /* avoid empty sdata/sbss area -- __eabi would not set up r13
235     * which may be important if run-time loading is used
236     */
237    . += 1;
238    PROVIDE (__SBSS_END__ = .);
239    PROVIDE (__sbss_end = .);
240    bsp_section_sbss_end = .;
241    bsp_section_sdata_libdl_begin = .;
242     . = DEFINED(bsp_section_small_data_area_size) ?
243         bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
244    bsp_section_sdata_libdl_end = .;
245  } > CODE
246  .plt   : { *(.plt) }  > CODE
247  .bss       :
248  {
249   PROVIDE (__bss_start = .);
250   *(.dynbss)
251   *(.bss .bss* .gnu.linkonce.b*)
252   *(COMMON)
253  . = ALIGN(16);
254   PROVIDE (__bss_end = .);
255  } > CODE
256  .rtemsstack (NOLOAD) : {
257    *(SORT(.rtemsstack.*))
258  } >CODE
259  . = ALIGN(16);
260  _end = . ;
261  __rtems_end = . ;
262  PROVIDE (end = .);
263  /DISCARD/ :
264  {
265    *(.comment)
266  }
267
268
269  /* Stabs debugging sections.  */
270  .stab 0 : { *(.stab) }
271  .stabstr 0 : { *(.stabstr) }
272  .stab.excl 0 : { *(.stab.excl) }
273  .stab.exclstr 0 : { *(.stab.exclstr) }
274  .stab.index 0 : { *(.stab.index) }
275  .stab.indexstr 0 : { *(.stab.indexstr) }
276  .comment 0 : { *(.comment) }
277
278  /* DWARF debug sections.
279     Symbols in the DWARF debugging sections are relative to the beginning
280     of the section so we begin them at 0.  */
281  /* DWARF 1 */
282  .debug          0 : { *(.debug) }
283  .line           0 : { *(.line) }
284 
285  /* GNU DWARF 1 extensions */
286  .debug_srcinfo  0 : { *(.debug_srcinfo) }
287  .debug_sfnames  0 : { *(.debug_sfnames) }
288 
289  /* DWARF 1.1 and DWARF 2 */
290  .debug_aranges  0 : { *(.debug_aranges) }
291  .debug_pubnames 0 : { *(.debug_pubnames) }
292 
293  /* DWARF 2 */
294  .debug_info     0 : { *(.debug_info) }
295  .debug_abbrev   0 : { *(.debug_abbrev) }
296  .debug_line     0 : { *(.debug_line) }
297  .debug_frame    0 : { *(.debug_frame) }
298  .debug_str      0 : { *(.debug_str) }
299  .debug_loc      0 : { *(.debug_loc) }
300  .debug_macinfo  0 : { *(.debug_macinfo) }
301 
302  /* SGI/MIPS DWARF 2 extensions */
303  .debug_weaknames 0 : { *(.debug_weaknames) }
304  .debug_funcnames 0 : { *(.debug_funcnames) }
305  .debug_typenames 0 : { *(.debug_typenames) }
306  .debug_varnames  0 : { *(.debug_varnames) }
307  /* These must appear regardless of  .  */
308}
Note: See TracBrowser for help on using the repository browser.