xref: /netbsd-src/sys/arch/evbmips/stand/sbmips/common/boot.ldscript (revision b1431b71daeb849d86a211537e1416d72a1397dc)
1/* Script for -N: mix text and data on same page; don't align data */
2OUTPUT_ARCH(mips)
3ENTRY(__start)
4SEARCH_DIR("=/usr/lib");
5SECTIONS
6{
7  /* Read-only sections, merged into text segment: */
8  PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x20000000)); . = SEGMENT_START("text-segment", 0x20000000) + SIZEOF_HEADERS;
9  .interp         : { *(.interp) }
10  .reginfo        : { *(.reginfo) }
11  .note.gnu.build-id : { *(.note.gnu.build-id) }
12  .dynamic        : { *(.dynamic) }
13  .hash           : { *(.hash) }
14  .gnu.hash       : { *(.gnu.hash) }
15  .dynsym         : { *(.dynsym) }
16  .dynstr         : { *(.dynstr) }
17  .gnu.version    : { *(.gnu.version) }
18  .gnu.version_d  : { *(.gnu.version_d) }
19  .gnu.version_r  : { *(.gnu.version_r) }
20  .rel.init       : { *(.rel.init) }
21  .rela.init      : { *(.rela.init) }
22  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
23  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
24  .rel.fini       : { *(.rel.fini) }
25  .rela.fini      : { *(.rela.fini) }
26  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
27  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
28  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
29  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
30  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
31  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
32  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
33  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
34  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
35  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
36  .rel.ctors      : { *(.rel.ctors) }
37  .rela.ctors     : { *(.rela.ctors) }
38  .rel.dtors      : { *(.rel.dtors) }
39  .rela.dtors     : { *(.rela.dtors) }
40  .rel.got        : { *(.rel.got) }
41  .rela.got       : { *(.rela.got) }
42  .rel.dyn        : { *(.rel.dyn) }
43  .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
44  .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
45  .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
46  .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
47  .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
48  .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
49  .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
50  .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
51  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
52  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
53  .rel.iplt       :
54    {
55      PROVIDE_HIDDEN (__rel_iplt_start = .);
56      *(.rel.iplt)
57      PROVIDE_HIDDEN (__rel_iplt_end = .);
58    }
59  .rela.iplt      :
60    {
61      PROVIDE_HIDDEN (__rela_iplt_start = .);
62      *(.rela.iplt)
63      PROVIDE_HIDDEN (__rela_iplt_end = .);
64    }
65  .rel.plt        :
66    {
67      *(.rel.plt)
68    }
69  .rela.plt       :
70    {
71      *(.rela.plt)
72    }
73  .init           :
74  {
75    KEEP (*(.init))
76  } =0
77  .plt            : { *(.plt) }
78  .iplt           : { *(.iplt) }
79  .text           :
80  {
81    _ftext = . ;
82    *(.text.unlikely .text.*_unlikely)
83    *(.text.exit .text.exit.*)
84    *(.text.startup .text.startup.*)
85    *(.text.hot .text.hot.*)
86    *(.text .stub .text.* .gnu.linkonce.t.*)
87    /* .gnu.warning sections are handled specially by elf32.em.  */
88    *(.gnu.warning)
89    *(.mips16.fn.*) *(.mips16.call.*)
90  } =0
91  .fini           :
92  {
93    KEEP (*(.fini))
94  } =0
95  PROVIDE (__etext = .);
96  PROVIDE (_etext = .);
97  PROVIDE (etext = .);
98  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
99  .rodata1        : { *(.rodata1) }
100  .sdata2         :
101  {
102    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
103  }
104  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
105  .eh_frame_hdr : { *(.eh_frame_hdr) }
106  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
107  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
108  /* Adjust the address for the data segment.  We want to adjust up to
109     the same address within the page on the next page up.  */
110  . = .;
111  /* Exception handling  */
112  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
113  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
114  /* Thread Local Storage sections  */
115  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
116  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
117  .preinit_array     :
118  {
119    PROVIDE_HIDDEN (__preinit_array_start = .);
120    KEEP (*(.preinit_array))
121    PROVIDE_HIDDEN (__preinit_array_end = .);
122  }
123  .init_array     :
124  {
125    PROVIDE_HIDDEN (__init_array_start = .);
126    KEEP (*(SORT(.init_array.*)))
127    KEEP (*(.init_array))
128    PROVIDE_HIDDEN (__init_array_end = .);
129  }
130  .fini_array     :
131  {
132    PROVIDE_HIDDEN (__fini_array_start = .);
133    KEEP (*(SORT(.fini_array.*)))
134    KEEP (*(.fini_array))
135    PROVIDE_HIDDEN (__fini_array_end = .);
136  }
137  .ctors          :
138  {
139    /* gcc uses crtbegin.o to find the start of
140       the constructors, so we make sure it is
141       first.  Because this is a wildcard, it
142       doesn't matter if the user does not
143       actually link against crtbegin.o; the
144       linker won't look for a file to match a
145       wildcard.  The wildcard also means that it
146       doesn't matter which directory crtbegin.o
147       is in.  */
148    KEEP (*crtbegin.o(.ctors))
149    KEEP (*crtbegin?.o(.ctors))
150    /* We don't want to include the .ctor section from
151       the crtend.o file until after the sorted ctors.
152       The .ctor section from the crtend file contains the
153       end of ctors marker and it must be last */
154    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
155    KEEP (*(SORT(.ctors.*)))
156    KEEP (*(.ctors))
157  }
158  .dtors          :
159  {
160    KEEP (*crtbegin.o(.dtors))
161    KEEP (*crtbegin?.o(.dtors))
162    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
163    KEEP (*(SORT(.dtors.*)))
164    KEEP (*(.dtors))
165  }
166  .jcr            : { KEEP (*(.jcr)) }
167  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
168  .data           :
169  {
170    _fdata = . ;
171    *(.data .data.* .gnu.linkonce.d.*)
172    SORT(CONSTRUCTORS)
173  }
174  .data1          : { *(.data1) }
175  .got.plt        : { *(.got.plt) }
176  . = .;
177  _gp = ALIGN(16) + 0x7ff0;
178  .got            : { *(.got) }
179  /* We want the small data sections together, so single-instruction offsets
180     can access them all, and initialized data all before uninitialized, so
181     we can shorten the on-disk segment size.  */
182  .sdata          :
183  {
184    *(.sdata .sdata.* .gnu.linkonce.s.*)
185  }
186  .lit8           : { *(.lit8) }
187  .lit4           : { *(.lit4) }
188  _edata = .; PROVIDE (edata = .);
189  __bss_start = .;
190  _fbss = .;
191  .sbss           :
192  {
193    *(.dynsbss)
194    *(.sbss .sbss.* .gnu.linkonce.sb.*)
195    *(.scommon)
196  }
197  .bss            :
198  {
199   *(.dynbss)
200   *(.bss .bss.* .gnu.linkonce.b.*)
201   *(COMMON)
202   /* Align here to ensure that the .bss section occupies space up to
203      _end.  Align after .bss to ensure correct alignment even if the
204      .bss section disappears because there are no input sections.
205      FIXME: Why do we need it? When there is no .bss section, we don't
206      pad the .data section.  */
207   . = ALIGN(. != 0 ? 32 / 8 : 1);
208  }
209  . = ALIGN(32 / 8);
210  . = ALIGN(32 / 8);
211  _end = .; PROVIDE (end = .);
212  /* Stabs debugging sections.  */
213  .stab          0 : { *(.stab) }
214  .stabstr       0 : { *(.stabstr) }
215  .stab.excl     0 : { *(.stab.excl) }
216  .stab.exclstr  0 : { *(.stab.exclstr) }
217  .stab.index    0 : { *(.stab.index) }
218  .stab.indexstr 0 : { *(.stab.indexstr) }
219  .comment       0 : { *(.comment) }
220  /* DWARF debug sections.
221     Symbols in the DWARF debugging sections are relative to the beginning
222     of the section so we begin them at 0.  */
223  /* DWARF 1 */
224  .debug          0 : { *(.debug) }
225  .line           0 : { *(.line) }
226  /* GNU DWARF 1 extensions */
227  .debug_srcinfo  0 : { *(.debug_srcinfo) }
228  .debug_sfnames  0 : { *(.debug_sfnames) }
229  /* DWARF 1.1 and DWARF 2 */
230  .debug_aranges  0 : { *(.debug_aranges) }
231  .debug_pubnames 0 : { *(.debug_pubnames) }
232  /* DWARF 2 */
233  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
234  .debug_abbrev   0 : { *(.debug_abbrev) }
235  .debug_line     0 : { *(.debug_line) }
236  .debug_frame    0 : { *(.debug_frame) }
237  .debug_str      0 : { *(.debug_str) }
238  .debug_loc      0 : { *(.debug_loc) }
239  .debug_macinfo  0 : { *(.debug_macinfo) }
240  /* SGI/MIPS DWARF 2 extensions */
241  .debug_weaknames 0 : { *(.debug_weaknames) }
242  .debug_funcnames 0 : { *(.debug_funcnames) }
243  .debug_typenames 0 : { *(.debug_typenames) }
244  .debug_varnames  0 : { *(.debug_varnames) }
245  /* DWARF 3 */
246  .debug_pubtypes 0 : { *(.debug_pubtypes) }
247  .debug_ranges   0 : { *(.debug_ranges) }
248  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
249  .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
250  .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
251  .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }
252  .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }
253  .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }
254  .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }
255  .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }
256  .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }
257  .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) }
258  .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) }
259  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
260}
261