source: rtems/bsps/powerpc/virtex5/start/linkcmds @ 5ed00353

Last change on this file since 5ed00353 was 5ed00353, checked in by Sebastian Huber <sebastian.huber@…>, on 07/14/22 at 12:41:03

bsps: Sort .noinit* sections

Sort the .noinit* input sections by name first, then by alignment if two
sections have the same name. This allows the placement of begin/end symbols to
initialize some areas with a special value.

Update #4678.

  • Property mode set to 100644
File size: 10.4 KB
Line 
1/*
2 *  This file contains directives for the GNU linker which are specific to the
3 *  Virtex 5 PPC 440.  No assumptions are made on the firmware in the FPGA.
4 *  This file is intended to be used together with start.S to generate
5 *  downloadable code.
6 */
7
8OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
9OUTPUT_ARCH(powerpc)
10
11STARTUP(start.o)
12ENTRY(download_entry)
13EXTERN(download_entry)
14EXTERN(__vectors)
15
16MsgAreaSize       = DEFINED(MsgAreaSize)   ? MsgAreaSize   : 1M;
17RamBase           = DEFINED(RamBase)       ? RamBase       : 0x0;
18RamSize           = DEFINED(RamSize)       ? RamSize       : 2048M - MsgAreaSize;
19RamEnd            = RamBase + RamSize;
20HeapSize          = DEFINED(HeapSize)      ? HeapSize      : 0; /* 0=Use def */
21
22
23MEMORY
24{
25  VECTORS         : ORIGIN = 0x00000000, LENGTH = 512
26  RAM             : ORIGIN = 0x00000200, LENGTH = 2048M - 512
27}
28
29
30SECTIONS
31{
32  bsp_exc_vector_base = 0;
33  __exeentry          = download_entry;
34  __exestart          = bsp_exc_vector_base;
35  .vectors bsp_exc_vector_base : { *(.vectors)                  } > VECTORS
36
37  /* Read-only sections, merged into text segment: */
38  .interp         : { *(.interp)                                } > RAM
39  .hash           : { *(.hash)                                  } > RAM
40  .dynsym         : { *(.dynsym)                                } > RAM
41  .dynstr         : { *(.dynstr)                                } > RAM
42  .gnu.version    : { *(.gnu.version)                           } > RAM
43  .gnu.version_d  : { *(.gnu.version_d)                         } > RAM
44  .gnu.version_r  : { *(.gnu.version_r)                         } > RAM
45  .rela.text      : { *(.rela.text) *(.rela.gnu.linkonce.t*)    } > RAM
46  .rela.data      : { *(.rela.data) *(.rela.gnu.linkonce.d*)    } > RAM
47  .rela.rodata    : { *(.rela.rodata*) *(.rela.gnu.linkonce.r*) } > RAM
48  .rela.got       : { *(.rela.got)                              } > RAM
49  .rela.got1      : { *(.rela.got1)                             } > RAM
50  .rela.got2      : { *(.rela.got2)                             } > RAM
51  .rela.ctors     : { *(.rela.ctors)                            } > RAM
52  .rela.dtors     : { *(.rela.dtors)                            } > RAM
53  .rela.init      : { *(.rela.init)                             } > RAM
54  .rela.fini      : { *(.rela.fini)                             } > RAM
55  .rela.bss       : { *(.rela.bss)                              } > RAM
56  .rela.plt       : { *(.rela.plt)                              } > RAM
57  .rela.sdata     : { *(.rela.sdata)                            } > RAM
58  .rela.sbss      : { *(.rela.sbss)                             } > RAM
59  .rela.sdata2    : { *(.rela.sdata2)                           } > RAM
60  .rela.sbss2     : { *(.rela.sbss2)                            } > RAM
61  .rela.dyn       : { *(.rela.dyn)                              } > RAM
62
63  /* Initialization code */
64  .init           : { PROVIDE (_init = .);
65                      *ecrti.o(.init)
66                      KEEP(*(.init))
67                      *ecrtn.o(.init)
68                    } > RAM
69
70  .text           : { *(.entry)
71                      *(.text)
72                      *(.text.*)
73
74                      /* Special FreeBSD sysctl sections */
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                       */
84                      *(.gnu.warning)
85                      *(.gnu.linkonce.t*)
86                    } > RAM
87
88  /* Finalization code */
89  .fini           : { PROVIDE (_fini = .);
90                      *ecrti.o(.fini)
91                      KEEP(*(.fini))
92                      *ecrtn.o(.fini)
93                    } > RAM
94
95  /* Miscellaneous read-only data */
96  .rodata         : { *(.rodata.* .gnu.linkonce.r*) KEEP (*(SORT(.rtemsroset.*))) } > RAM
97  .rodata1        : { *(.rodata1)                                      } > RAM
98
99  .tdata : {
100    _TLS_Data_begin = .;
101    *(.tdata .tdata.* .gnu.linkonce.td.*)
102    _TLS_Data_end = .;
103  } >RAM
104
105  .tbss : {
106    _TLS_BSS_begin = .;
107    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
108    _TLS_BSS_end = .;
109  } >RAM
110
111  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
112  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
113  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
114  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
115  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
116  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
117
118  /* Initialised small data addressed as offsets from r2 */
119  .sdata2         : { PROVIDE (_SDA2_BASE_ = 32768); *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)          } > RAM
120
121  /* Zeroed small data addressed as offsets from r2 */
122  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
123
124                      /* Avoid empty sdata2/sbss2 area: __eabi would not set up
125                       * r2 which may be important if run-time loading is used
126                       */
127                      . += 1;
128
129                      PROVIDE (__SBSS2_END__ = .);
130                    } > RAM
131
132  /* Exception frame info */
133  .eh_frame       : { *(.eh_frame .eh_frame.*)                         } > RAM
134  .eh_frame_hdr   : { *(.eh_frame_hdr)                                 } > RAM
135
136  /*  Declares where the .text section ends */
137  _etext          = .;
138  PROVIDE (etext  = .);
139
140  /* Initialized R/W Data section goes in RAM */
141  .data           : { PROVIDE(__DATA_START__ = ABSOLUTE(.) );
142                      *(.data)
143                      *(.data.*)
144                      KEEP (*(SORT(.rtemsrwset.*)))
145                      *(.gnu.linkonce.d*)
146                    } > RAM
147
148  .data1          : { *(.data1)                                        } > RAM
149
150                        PROVIDE (__EXCEPT_START__ = .);
151  .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*)       } > RAM
152                        PROVIDE (__EXCEPT_END__ = .);
153
154  .got1           : { *(.got1)                                         } > RAM
155
156  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
157   * get relocated with -mrelocatable. Also put in the .fixup pointers.
158   * The current compiler no longer needs this, but keep it around for 2.7.2.
159   */
160                      PROVIDE (_GOT2_START_ = .);
161  .got2           : { *(.got2)                                         } > RAM
162
163  .dynamic        : { *(.dynamic)                                      } > RAM
164
165  .ctors          : {
166                      KEEP (*ecrti.o(.ctors))
167                      KEEP (*crtbegin.o(.ctors))
168                      KEEP (*crtbegin?.o(.ctors))
169                      KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .ctors))
170                      KEEP (*(SORT(.ctors.*)))
171                      KEEP (*(.ctors))
172                    } > RAM
173
174  .dtors          : {
175                      KEEP (*ecrti.o(.dtors))
176                      KEEP (*crtbegin.o(.dtors))
177                      KEEP (*crtbegin?.o(.dtors))
178                      KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *ecrtn.o) .dtors))
179                      KEEP (*(SORT(.dtors.*)))
180                      KEEP (*(.dtors))
181                    } > RAM
182
183                      PROVIDE (_FIXUP_START_ = .);
184  .fixup          : { *(.fixup)                                        } > RAM
185                      PROVIDE (_FIXUP_END_ = .);
186
187                      PROVIDE (_GOT2_END_ = .);
188
189                      PROVIDE (_GOT_START_ = .);
190  .got            : { __got_start = .;
191                      *(.got)
192                    } > RAM
193
194  .got.plt        : { *(.got.plt)                                      } > RAM
195                      PROVIDE (_GOT_END_ = .);
196
197  .jcr            : { KEEP (*(.jcr))                                   } > RAM
198
199  /* We want the small data sections together, so single-instruction offsets
200   * can access them all, and initialized data all before uninitialized, so
201   * we can shorten the on-disk segment size.
202   */
203  /* Initialised small data addressed as offsets from r13 */
204  .sdata          : {
205        bsp_section_sdata_begin = .;
206        PROVIDE (_SDA_BASE_ = 32768); *(.sdata* .gnu.linkonce.s.*);
207        bsp_section_sdata_end = .;
208   } > RAM
209
210  _edata          = .;
211  PROVIDE (edata  = .);
212
213  /* Zeroed small data addressed as offsets from r13 */
214  .sbss           : { PROVIDE (__sbss_start = .);
215                      bsp_section_sbss_begin = .;
216                      *(.dynsbss)
217                      *(.sbss*)
218                      *(.gnu.linkonce.sb.*)
219                      *(.scommon)
220
221                      /* Avoid empty sdata/sbss area: __eabi would not set up
222                       * r13, which may be important if run-time loading is used
223                       */
224                      . += 1;
225
226                      PROVIDE (__SBSS_END__ = .);
227                      PROVIDE (__sbss_end   = .);
228                      bsp_section_sbss_end = .;
229                      bsp_section_sdata_libdl_begin = .;
230                      . = DEFINED(bsp_section_small_data_area_size) ?
231                        bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
232                      bsp_section_sdata_libdl_end = .;
233                    } > RAM
234
235  .plt            : { *(.plt)                                          } > RAM
236  .iplt           : { *(.iplt)                                         } > RAM
237
238  /* Zeroed large data */
239  .bss            : { PROVIDE (__bss_start = .);
240                      *(.dynbss)
241                      *(.bss)
242                      *(.bss.*)
243                      *(.gnu.linkonce.b*)
244                      *(COMMON)
245
246                      PROVIDE (__bss_end = ALIGN(4));
247                      __bss_size = __bss_end - __bss_start;
248                    } > RAM
249
250  __exeend        = ALIGN(4);
251  __rtems_end     = .;
252  .               = ALIGN(0x20);        /* Align to a cache-line boundary */
253  PROVIDE(__bsp_ram_start = .);
254
255  .noinit (NOLOAD) : {
256    *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*)))
257  } >RAM
258
259  .rtemsstack (NOLOAD) : {
260    *(SORT(.rtemsstack.*))
261  } >RAM
262
263  WorkAreaBase = .;
264
265  /* The heap comes after the work space */
266
267   .              = RamBase + RamSize;
268  PROVIDE(__bsp_ram_end = .);
269
270  /* Message area for capturing early printk output */
271  /* Placed here to be easily findable with a debugger */
272  MsgAreaBase     = __bsp_ram_end;
273  .              += MsgAreaSize;
274
275  __phy_ram_end   = .;                  /* True end of physical memory */
276
277  /DISCARD/ :
278  {
279    *(.comment)
280  }
281
282  /* Some configuration constants */
283  __vectors       = 0;
284}
Note: See TracBrowser for help on using the repository browser.