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

5
Last change on this file since 96e4b22 was dbe6e0ad, checked in by Sebastian Huber <sebastian.huber@…>, on 03/04/19 at 08:22:32

bsps/powerpc: Move .rtemstack section

Move the .rtemsstack section from a read-only to a read-write area, see
page table setup in BSP_default_pgtbl_setup().

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