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

Last change on this file since ec1dd51a was ec1dd51a, checked in by Chris Johns <chrisj@…>, on Mar 6, 2019 at 10:15:56 AM

libdl: Add small data support to the remaining PowerPC BSPs.

Updates #3687

  • Property mode set to 100644
File size: 10.5 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       : { *(.eh_frame)              } >CODE
138
139  /* NOTE: if the BSP uses page tables, the correctness of
140   *       '_etext' (and __DATA_START__) is CRUCIAL - otherwise,
141   *       an invalid mapping may result!!!
142   */
143  _etext = .;
144  PROVIDE (etext = .);
145
146  /* Adjust the address for the data segment.  We want to adjust up to
147     the same address within the page on the next page up.  It would
148     be more correct to do this:
149       . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1));
150     The current expression does not correctly handle the case of a
151     text segment ending precisely at the end of a page; it causes the
152     data segment to skip a page.  The above expression does not have
153     this problem, but it will currently (2/95) cause BFD to allocate
154     a single segment, combining both text and data, for this case.
155     This will prevent the text segment from being shared among
156     multiple executions of the program; I think that is more
157     important than losing a page of the virtual address space (note
158     that no actual memory is lost; the page which is skipped can not
159     be referenced).  */
160  . = ALIGN(0x1000);
161 .data ALIGN(0x1000) :
162  {
163   /* NOTE: if the BSP uses page tables, the correctness of
164    *       '__DATA_START__' (and _etext) is CRUCIAL - otherwise,
165    *       an invalid mapping may result!!!
166    */
167        PROVIDE(__DATA_START__ = ABSOLUTE(.) );
168    *(.data .data.* .gnu.linkonce.d*)   
169    KEEP (*(SORT(.rtemsrwset.*)))
170    SORT(CONSTRUCTORS)
171  } > CODE
172  .data1   : { *(.data1) }      > CODE
173  PROVIDE (__EXCEPT_START__ = .);
174  .gcc_except_table   : { *(.gcc_except_table*) } > CODE
175  PROVIDE (__EXCEPT_END__ = .);
176  .got1           : { *(.got1) }        > CODE
177  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
178     get relocated with -mrelocatable. Also put in the .fixup pointers.
179     The current compiler no longer needs this, but keep it around for 2.7.2  */
180                PROVIDE (_GOT2_START_ = .);
181  .got2           :  { *(.got2) }       > CODE
182  .dynamic        : { *(.dynamic) }     > CODE
183
184  .ctors          :
185  {
186    /* gcc uses crtbegin.o to find the start of
187       the constructors, so we make sure it is
188       first.  Because this is a wildcard, it
189       doesn't matter if the user does not
190       actually link against crtbegin.o; the
191       linker won't look for a file to match a
192       wildcard.  The wildcard also means that it
193       doesn't matter which directory crtbegin.o
194       is in.  */
195    KEEP (*crtbegin.o(.ctors))
196    /* We don't want to include the .ctor section from
197       from the crtend.o file until after the sorted ctors.
198       The .ctor section from the crtend file contains the
199       end of ctors marker and it must be last */
200    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
201    KEEP (*(SORT(.ctors.*)))
202    KEEP (*(.ctors))
203  } > CODE
204  .dtors          :
205  {
206    KEEP (*crtbegin.o(.dtors))
207    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
208    KEEP (*(SORT(.dtors.*)))
209    KEEP (*(.dtors))
210  } > CODE
211
212
213                PROVIDE (_FIXUP_START_ = .);
214  .fixup          : { *(.fixup) }       > CODE
215                PROVIDE (_FIXUP_END_ = .);
216                PROVIDE (_GOT2_END_ = .);
217                PROVIDE (_GOT_START_ = .);
218
219  .got            : { *(.got) } > CODE
220  .got.plt        : { *(.got.plt) }     > CODE
221
222                PROVIDE (_GOT_END_ = .);
223
224  .jcr            : { KEEP (*(.jcr)) } > CODE
225
226  /* We want the small data sections together, so single-instruction offsets
227     can access them all, and initialized data all before uninitialized, so
228     we can shorten the on-disk segment size.  */
229  .sdata : {
230    bsp_section_sdata_begin = .;
231    PROVIDE (_SDA_BASE_ = 32768);
232    *(.sdata*) *(.gnu.linkonce.s.*)
233    bsp_section_sdata_end = .;
234  } > CODE
235  _edata  =  .;
236  PROVIDE (edata = .);
237  .sbss      :
238  {
239    bsp_section_sbss_begin = .;
240    PROVIDE (__sbss_start = .);
241    *(.dynsbss)
242    *(.sbss* .gnu.linkonce.sb.*)
243    *(.scommon)
244    /* avoid empty sdata/sbss area -- __eabi would not set up r13
245     * which may be important if run-time loading is used
246     */
247    . += 1;
248    PROVIDE (__SBSS_END__ = .);
249    PROVIDE (__sbss_end = .);
250    bsp_section_sbss_end = .;
251    bsp_section_sdata_libdl_begin = .;
252     . = DEFINED(bsp_section_small_data_area_size) ?
253         bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
254    bsp_section_sdata_libdl_end = .;
255  } > CODE
256  .plt   : { *(.plt) }  > CODE
257  .bss       :
258  {
259   PROVIDE (__bss_start = .);
260   *(.dynbss)
261   *(.bss .bss* .gnu.linkonce.b*)
262   *(COMMON)
263  . = ALIGN(16);
264   PROVIDE (__bss_end = .);
265  } > CODE
266  .rtemsstack (NOLOAD) : {
267    *(SORT(.rtemsstack.*))
268  } >CODE
269  . = ALIGN(16);
270  _end = . ;
271  __rtems_end = . ;
272  PROVIDE (end = .);
273  /DISCARD/ :
274  {
275    *(.comment)
276  }
277
278
279  /* Stabs debugging sections.  */
280  .stab 0 : { *(.stab) }
281  .stabstr 0 : { *(.stabstr) }
282  .stab.excl 0 : { *(.stab.excl) }
283  .stab.exclstr 0 : { *(.stab.exclstr) }
284  .stab.index 0 : { *(.stab.index) }
285  .stab.indexstr 0 : { *(.stab.indexstr) }
286  .comment 0 : { *(.comment) }
287
288  /* DWARF debug sections.
289     Symbols in the DWARF debugging sections are relative to the beginning
290     of the section so we begin them at 0.  */
291  /* DWARF 1 */
292  .debug          0 : { *(.debug) }
293  .line           0 : { *(.line) }
294 
295  /* GNU DWARF 1 extensions */
296  .debug_srcinfo  0 : { *(.debug_srcinfo) }
297  .debug_sfnames  0 : { *(.debug_sfnames) }
298 
299  /* DWARF 1.1 and DWARF 2 */
300  .debug_aranges  0 : { *(.debug_aranges) }
301  .debug_pubnames 0 : { *(.debug_pubnames) }
302 
303  /* DWARF 2 */
304  .debug_info     0 : { *(.debug_info) }
305  .debug_abbrev   0 : { *(.debug_abbrev) }
306  .debug_line     0 : { *(.debug_line) }
307  .debug_frame    0 : { *(.debug_frame) }
308  .debug_str      0 : { *(.debug_str) }
309  .debug_loc      0 : { *(.debug_loc) }
310  .debug_macinfo  0 : { *(.debug_macinfo) }
311 
312  /* SGI/MIPS DWARF 2 extensions */
313  .debug_weaknames 0 : { *(.debug_weaknames) }
314  .debug_funcnames 0 : { *(.debug_funcnames) }
315  .debug_typenames 0 : { *(.debug_typenames) }
316  .debug_varnames  0 : { *(.debug_varnames) }
317  /* These must appear regardless of  .  */
318}
Note: See TracBrowser for help on using the repository browser.