source: rtems/bsps/i386/pc386/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: 9.0 KB
Line 
1/*
2 *  Copy of default "default linker script, for normal executables"
3 *  provided with binutils 2.18 with minor modifications for use
4 *  as pc386 linkcmds.  These changes include:
5 *
6 *    + sections commented out marked with "XXX commented out --joel"
7 *    + addition of m_hdr section
8 *    + addition of FreeBSD sysctl sections
9 */
10
11/*
12 * XXX commented out --joel
13OUTPUT_FORMAT("elf32-i386", "elf32-i386",
14              "elf32-i386")
15OUTPUT_ARCH(i386)
16*/
17STARTUP(start.o)
18ENTRY(start)
19HeapSize = DEFINED(HeapSize) ? HeapSize :
20          DEFINED(_HeapSize) ? _HeapSize : 0x0;
21RamSize = DEFINED(RamSize) ? RamSize    :
22          DEFINED(_RamSize) ? _RamSize : 0xFFFFFFFF;
23
24SECTIONS
25{
26  /* Read-only sections, merged into text segment: */
27/*
28 * XXX commented out --joel
29  PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS;
30*/
31  .interp         : { *(.interp) }
32  .note.gnu.build-id : { *(.note.gnu.build-id) }
33  .hash           : { *(.hash) }
34  .gnu.hash       : { *(.gnu.hash) }
35  .dynsym         : { *(.dynsym) }
36  .dynstr         : { *(.dynstr) }
37  .gnu.version    : { *(.gnu.version) }
38  .gnu.version_d  : { *(.gnu.version_d) }
39  .gnu.version_r  : { *(.gnu.version_r) }
40  .rel.init       : { *(.rel.init) }
41  .rela.init      : { *(.rela.init) }
42  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
43  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
44  .rel.fini       : { *(.rel.fini) }
45  .rela.fini      : { *(.rela.fini) }
46  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
47  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
48  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
49  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
50  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
51  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
52  .rel.tdata      : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
53  .rela.tdata     : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
54  .rel.tbss       : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
55  .rela.tbss      : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
56  .rel.ctors      : { *(.rel.ctors) }
57  .rela.ctors     : { *(.rela.ctors) }
58  .rel.dtors      : { *(.rel.dtors) }
59  .rela.dtors     : { *(.rela.dtors) }
60  .rel.got        : { *(.rel.got) }
61  .rela.got       : { *(.rela.got) }
62  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
63  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
64  .rel.plt        : { *(.rel.plt) }
65  .rela.plt       : { *(.rela.plt) }
66  .plt            : { *(.plt) }
67  .text           :
68  {
69   *(.m_hdr)
70    *(.text .stub .text.* .gnu.linkonce.t.*)
71    KEEP (*(.text.*personality*))
72    /* .gnu.warning sections are handled specially by elf32.em.  */
73    *(.gnu.warning)
74
75  } =0x90909090
76
77  .rtemsroset : {
78    /* for pre rtems-libbsd FreeBSD code */
79    __start_set_sysctl_set = .;
80    *(set_sysctl_*);
81    __stop_set_sysctl_set = .;
82    *(set_domain_*);
83    *(set_pseudo_*);
84
85    KEEP (*(SORT(.rtemsroset.*)))
86  } =0x90909090
87
88  .init           :
89  {
90    KEEP (*(.init))
91  } =0x90909090
92  .fini           :
93  {
94    KEEP (*(.fini))
95  } =0x90909090
96  PROVIDE (__etext = .);
97  PROVIDE (_etext = .);
98  PROVIDE (etext = .);
99  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
100  .rodata1        : { *(.rodata1) }
101  .tdata : {
102    _TLS_Data_begin = .;
103    *(.tdata .tdata.* .gnu.linkonce.td.*)
104    _TLS_Data_end = .;
105  }
106  .tbss : {
107    _TLS_BSS_begin = .;
108    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
109    _TLS_BSS_end = .;
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  .eh_frame_hdr : { *(.eh_frame_hdr) }
118  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
119  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
120  /* Adjust the address for the data segment.  We want to adjust up to
121     the same address within the page on the next page up.  */
122  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
123  /* Exception handling  */
124  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
125  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
126  /* Thread Local Storage sections  */
127  .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
128  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
129  .preinit_array     :
130  {
131    PROVIDE_HIDDEN (__preinit_array_start = .);
132    KEEP (*(.preinit_array))
133    PROVIDE_HIDDEN (__preinit_array_end = .);
134  }
135  .init_array     :
136  {
137     PROVIDE_HIDDEN (__init_array_start = .);
138     KEEP (*(SORT(.init_array.*)))
139     KEEP (*(.init_array))
140     PROVIDE_HIDDEN (__init_array_end = .);
141  }
142  .fini_array     :
143  {
144    PROVIDE_HIDDEN (__fini_array_start = .);
145    KEEP (*(.fini_array))
146    KEEP (*(SORT(.fini_array.*)))
147    PROVIDE_HIDDEN (__fini_array_end = .);
148  }
149  .ctors          :
150  {
151    /* gcc uses crtbegin.o to find the start of
152       the constructors, so we make sure it is
153       first.  Because this is a wildcard, it
154       doesn't matter if the user does not
155       actually link against crtbegin.o; the
156       linker won't look for a file to match a
157       wildcard.  The wildcard also means that it
158       doesn't matter which directory crtbegin.o
159       is in.  */
160    KEEP (*crtbegin.o(.ctors))
161    KEEP (*crtbegin?.o(.ctors))
162    /* We don't want to include the .ctor section from
163       the crtend.o file until after the sorted ctors.
164       The .ctor section from the crtend file contains the
165       end of ctors marker and it must be last */
166    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
167    KEEP (*(SORT(.ctors.*)))
168    KEEP (*(.ctors))
169  }
170  .dtors          :
171  {
172    KEEP (*crtbegin.o(.dtors))
173    KEEP (*crtbegin?.o(.dtors))
174    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
175    KEEP (*(SORT(.dtors.*)))
176    KEEP (*(.dtors))
177  }
178  .jcr            : { KEEP (*(.jcr)) }
179  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
180  .dynamic        : { *(.dynamic) }
181  .got            : { *(.got) }
182  . = DATA_SEGMENT_RELRO_END (12, .);
183  .got.plt        : { *(.got.plt) }
184  .data           :
185  {
186    *(.data .data.* .gnu.linkonce.d.*)
187    KEEP (*(.gnu.linkonce.d.*personality*))
188    SORT(CONSTRUCTORS)
189  }
190  .data1          : { *(.data1) }
191  .rtemsrwset     : { KEEP (*(SORT(.rtemsrwset.*))) }
192  _edata = .; PROVIDE (edata = .);
193  __bss_start = .;
194  .bss            :
195  {
196   *(.dynbss)
197   *(.bss .bss.* .gnu.linkonce.b.*)
198   *(COMMON)
199   /* Align here to ensure that the .bss section occupies space up to
200      _end.  Align after .bss to ensure correct alignment even if the
201      .bss section disappears because there are no input sections.
202      FIXME: Why do we need it? When there is no .bss section, we don't
203      pad the .data section.  */
204   . = ALIGN(. != 0 ? 32 / 8 : 1);
205  }
206  . = ALIGN(32 / 8);
207  _end = .; PROVIDE (end = .);
208  .noinit (NOLOAD) : {
209    *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*)))
210  }
211  .rtemsstack (NOLOAD) : {
212    *(SORT(.rtemsstack.*))
213  }
214  WorkAreaBase = .;
215  . = DATA_SEGMENT_END (.);
216
217  /* Stabs debugging sections.  */
218  .stab          0 : { *(.stab) }
219  .stabstr       0 : { *(.stabstr) }
220  .stab.excl     0 : { *(.stab.excl) }
221  .stab.exclstr  0 : { *(.stab.exclstr) }
222  .stab.index    0 : { *(.stab.index) }
223  .stab.indexstr 0 : { *(.stab.indexstr) }
224  .comment       0 : { *(.comment) }
225  /* DWARF debug sections.
226     Symbols in the DWARF debugging sections are relative to the beginning
227     of the section so we begin them at 0.  */
228  /* DWARF 1 */
229  .debug          0 : { *(.debug) }
230  .line           0 : { *(.line) }
231  /* GNU DWARF 1 extensions */
232  .debug_srcinfo  0 : { *(.debug_srcinfo) }
233  .debug_sfnames  0 : { *(.debug_sfnames) }
234  /* DWARF 1.1 and DWARF 2 */
235  .debug_aranges  0 : { *(.debug_aranges) }
236  .debug_pubnames 0 : { *(.debug_pubnames) }
237  /* DWARF 2 */
238  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
239  .debug_abbrev   0 : { *(.debug_abbrev) }
240  .debug_line     0 : { *(.debug_line) }
241  .debug_frame    0 : { *(.debug_frame) }
242  .debug_str      0 : { *(.debug_str) }
243  .debug_loc      0 : { *(.debug_loc) }
244  .debug_macinfo  0 : { *(.debug_macinfo) }
245  /* SGI/MIPS DWARF 2 extensions */
246  .debug_weaknames 0 : { *(.debug_weaknames) }
247  .debug_funcnames 0 : { *(.debug_funcnames) }
248  .debug_typenames 0 : { *(.debug_typenames) }
249  .debug_varnames  0 : { *(.debug_varnames) }
250  /* DWARF 3 */
251  .debug_pubtypes 0 : { *(.debug_pubtypes) }
252  .debug_ranges   0 : { *(.debug_ranges) }
253  /* DWARF extension */
254  .debug_macro    0 : { *(.debug_macro) }
255  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
256  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
257}
Note: See TracBrowser for help on using the repository browser.