ldscript.mips revision 201985
1/*-
2 * Copyright (c) 2001, 2004, 2008, Juniper Networks, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the Juniper Networks, Inc. nor the names of its
14 *    contributors may be used to endorse or promote products derived from
15 *    this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY JUNIPER NETWORKS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL JUNIPER NETWORKS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 *	JNPR: ldscript.mips,v 1.3 2006/10/11 06:12:04
30 * $FreeBSD: head/sys/conf/ldscript.mips 201985 2010-01-10 05:36:38Z imp $
31 */
32
33OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", 
34		"elf32-tradlittlemips")
35
36OUTPUT_ARCH(mips)
37ENTRY(_start)
38SEARCH_DIR(/usr/lib);
39/* Do we need any of these for elf?
40   __DYNAMIC = 0;
41PROVIDE (_DYNAMIC = 0);
42*/
43SECTIONS
44{
45  /* Read-only sections, merged into text segment: */
46  . = KERNLOADADDR + SIZEOF_HEADERS;
47  .interp     : { *(.interp) 	}
48  .hash          : { *(.hash)		}
49  .dynsym        : { *(.dynsym)		}
50  .dynstr        : { *(.dynstr)		}
51  .gnu.version   : { *(.gnu.version)	}
52  .gnu.version_d   : { *(.gnu.version_d)	}
53  .gnu.version_r   : { *(.gnu.version_r)	}
54  .rel.init      : { *(.rel.init)	}
55  .rela.init     : { *(.rela.init)	}
56  .rel.text      :
57    {
58      *(.rel.text)
59      *(.rel.text.*)
60      *(.rel.gnu.linkonce.t.*)
61    }
62  .rela.text     :
63    {
64      *(.rela.text)
65      *(.rela.text.*)
66      *(.rela.gnu.linkonce.t.*)
67    }
68  .rel.fini      : { *(.rel.fini)	}
69  .rela.fini     : { *(.rela.fini)	}
70  .rel.rodata    :
71    {
72      *(.rel.rodata)
73      *(.rel.rodata.*)
74      *(.rel.gnu.linkonce.r.*)
75    }
76  .rela.rodata   :
77    {
78      *(.rela.rodata)
79      *(.rela.rodata.*)
80      *(.rela.gnu.linkonce.r.*)
81    }
82  .rel.data      :
83    {
84      *(.rel.data)
85      *(.rel.data.*)
86      *(.rel.gnu.linkonce.d.*)
87    }
88  .rela.data     :
89    {
90      *(.rela.data)
91      *(.rela.data.*)
92      *(.rela.gnu.linkonce.d.*)
93    }
94  .rel.ctors     : { *(.rel.ctors)	}
95  .rela.ctors    : { *(.rela.ctors)	}
96  .rel.dtors     : { *(.rel.dtors)	}
97  .rela.dtors    : { *(.rela.dtors)	}
98  .rel.got       : { *(.rel.got)		}
99  .rela.got      : { *(.rela.got)		}
100  .rel.sdata     :
101    {
102      *(.rel.sdata)
103      *(.rel.sdata.*)
104      *(.rel.gnu.linkonce.s.*)
105    }
106  .rela.sdata     :
107    {
108      *(.rela.sdata)
109      *(.rela.sdata.*)
110      *(.rela.gnu.linkonce.s.*)
111    }
112  .rel.sbss      :
113    { 
114      *(.rel.sbss)
115      *(.rel.sbss.*)
116      *(.rel.gnu.linkonce.sb.*)
117    }
118  .rela.sbss     :
119    {
120      *(.rela.sbss)
121      *(.rela.sbss.*)
122      *(.rel.gnu.linkonce.sb.*)
123    }
124  .rel.sdata2    : 
125    { 
126      *(.rel.sdata2)
127      *(.rel.sdata2.*)
128      *(.rel.gnu.linkonce.s2.*)
129    }
130  .rela.sdata2   : 
131    {
132      *(.rela.sdata2)
133      *(.rela.sdata2.*)
134      *(.rela.gnu.linkonce.s2.*)
135    }
136  .rel.sbss2     : 
137    { 
138      *(.rel.sbss2)	
139      *(.rel.sbss2.*)
140      *(.rel.gnu.linkonce.sb2.*)
141    }
142  .rela.sbss2    : 
143    { 
144      *(.rela.sbss2)	
145      *(.rela.sbss2.*)
146      *(.rela.gnu.linkonce.sb2.*)
147    }
148  .rel.bss       : 
149    { 
150      *(.rel.bss)
151      *(.rel.bss.*)
152      *(.rel.gnu.linkonce.b.*)
153    }
154  .rela.bss      : 
155    { 
156      *(.rela.bss)
157      *(.rela.bss.*)
158      *(.rela.gnu.linkonce.b.*)
159    }
160  .rel.plt       : { *(.rel.plt)		}
161  .rela.plt      : { *(.rela.plt)		}
162  .init          : 
163  { 
164    KEEP (*(.init))
165  } =0x1000000
166  .text      :
167  {
168    *(.trap)
169    *(.text)
170    *(.text.*)
171    *(.stub)
172    /* .gnu.warning sections are handled specially by elf32.em.  */
173    *(.gnu.warning)
174    *(.gnu.linkonce.t.*)
175  } =0x1000000
176  .fini      :
177  {
178    KEEP (*(.fini))
179  } =0x1000000
180  PROVIDE (__etext = .);
181  PROVIDE (_etext = .);
182  PROVIDE (etext = .);
183  .rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) }
184  .rodata1   : { *(.rodata1) }
185  .reginfo : { *(.reginfo) }
186  .sdata2   : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) }
187  .sbss2   : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) }
188  . = ALIGN(0x2000) + (. & (0x2000 - 1));
189  .data    :
190  {
191    *(.data)
192    *(.data.*)
193    *(.gnu.linkonce.d.*)
194    SORT(CONSTRUCTORS)
195  }
196  .data1   : { *(.data1) }
197  .eh_frame : { KEEP (*(.eh_frame)) }
198  .gcc_except_table : { *(.gcc_except_table) }
199  .ctors   : 
200  {
201    /* gcc uses crtbegin.o to find the start of
202       the constructors, so we make sure it is
203       first.  Because this is a wildcard, it
204       doesn't matter if the user does not
205       actually link against crtbegin.o; the
206       linker won't look for a file to match a
207       wildcard.  The wildcard also means that it
208       doesn't matter which directory crtbegin.o
209       is in.  */
210    KEEP (*crtbegin.o(.ctors))
211    /* We don't want to include the .ctor section from
212       from the crtend.o file until after the sorted ctors.
213       The .ctor section from the crtend file contains the
214       end of ctors marker and it must be last */
215    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
216    KEEP (*(SORT(.ctors.*)))
217    KEEP (*(.ctors))
218  }
219   .dtors         :
220  {
221    KEEP (*crtbegin.o(.dtors))
222    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
223    KEEP (*(SORT(.dtors.*)))
224    KEEP (*(.dtors))
225  }
226  .plt      : { *(.plt)	}
227  _gp = ALIGN(16) + 0x7ff0;
228  .got		  : { *(.got.plt) *(.got) }
229  .dynamic       : { *(.dynamic) }
230  /* We want the small data sections together, so single-instruction offsets
231     can access them all, and initialized data all before uninitialized, so
232     we can shorten the on-disk segment size.  */
233  .sdata     : 
234  {
235    *(.sdata) 
236    *(.sdata.*)
237    *(.gnu.linkonce.s.*)
238  }
239  _edata = .;
240  PROVIDE (edata = .);
241  __bss_start = .;
242  .sbss      :
243  {
244    PROVIDE (__sbss_start = .);
245    PROVIDE (___sbss_start = .);
246    *(.dynsbss)
247    *(.sbss)
248    *(.sbss.*)
249    *(.gnu.linkonce.sb.*)
250    *(.scommon)
251    PROVIDE (__sbss_end = .);
252    PROVIDE (___sbss_end = .);
253  }
254  .bss       :
255  {
256   *(.dynbss)
257   *(.bss)
258   *(.bss.*)
259   *(.gnu.linkonce.b.*)
260   *(COMMON)
261   /* Align here to ensure that the .bss section occupies space up to
262      _end.  Align after .bss to ensure correct alignment even if the
263      .bss section disappears because there are no input sections.  */
264   . = ALIGN(64 / 8);
265  }
266  . = ALIGN(64 / 8);
267  _end = .;
268  PROVIDE (end = .);
269  /* Stabs debugging sections.  */
270  .stab 0 : { *(.stab) }
271  .stabstr 0 : { *(.stabstr) }
272  .stab.excl 0 : { *(.stab.excl) }
273  .stab.exclstr 0 : { *(.stab.exclstr) }
274  .stab.index 0 : { *(.stab.index) }
275  .stab.indexstr 0 : { *(.stab.indexstr) }
276  .comment 0 : { *(.comment) }
277  /* DWARF debug sections.
278     Symbols in the DWARF debugging sections are relative to the beginning
279     of the section so we begin them at 0.  */
280  /* DWARF 1 */
281  .debug          0 : { *(.debug) }
282  .line           0 : { *(.line) }
283  /* GNU DWARF 1 extensions */
284  .debug_srcinfo  0 : { *(.debug_srcinfo) }
285  .debug_sfnames  0 : { *(.debug_sfnames) }
286  /* DWARF 1.1 and DWARF 2 */
287  .debug_aranges  0 : { *(.debug_aranges) }
288  .debug_pubnames 0 : { *(.debug_pubnames) }
289  /* DWARF 2 */
290  .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
291  .debug_abbrev   0 : { *(.debug_abbrev) }
292  .debug_line     0 : { *(.debug_line) }
293  .debug_frame    0 : { *(.debug_frame) }
294  .debug_str      0 : { *(.debug_str) }
295  .debug_loc      0 : { *(.debug_loc) }
296  .debug_macinfo  0 : { *(.debug_macinfo) }
297  /* SGI/MIPS DWARF 2 extensions */
298  .debug_weaknames 0 : { *(.debug_weaknames) }
299  .debug_funcnames 0 : { *(.debug_funcnames) }
300  .debug_typenames 0 : { *(.debug_typenames) }
301  .debug_varnames  0 : { *(.debug_varnames) }
302  /* These must appear regardless of  .  */
303}
304