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

5
Last change on this file since 715d616 was 715d616, checked in by Sebastian Huber <sebastian.huber@…>, on 06/19/18 at 13:10:36

bsps: Support .rtemsstack.* linker input sections

Use a dedicated memory region or place it between the BSS and workspace.

Update #3459.

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