ldscript.mips.cfe revision 317145
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: stable/11/sys/conf/ldscript.mips.cfe 317145 2017-04-19 15:33:24Z emaste $
31 */
32
33/*
34 * This linker script is needed to build a kernel for use by Broadcom CFE
35 * when loaded over TFTP; its ELF loader does not support backwards seek
36 * on network I/O streams.
37 * Furthermore, CFE will only load PT_LOAD segments, therefore the dynamic
38 * sections must be placed in their own segment.
39 */
40
41ENTRY(_start)
42SEARCH_DIR(/usr/lib);
43
44PHDRS
45{
46 headers PT_PHDR FILEHDR PHDRS ;
47 interp PT_INTERP ;
48 text PT_LOAD ;
49 dynamic PT_LOAD ;
50 data PT_LOAD ;
51}
52
53SECTIONS
54{
55  /* Read-only sections, merged into text segment: */
56  . = KERNLOADADDR ;
57  .interp     : { *(.interp) 	} :interp
58  .hash          : { *(.hash)		} :text
59  .dynsym        : { *(.dynsym)		}
60  .dynstr        : { *(.dynstr)		}
61  .gnu.version   : { *(.gnu.version)	}
62  .gnu.version_d   : { *(.gnu.version_d)	}
63  .gnu.version_r   : { *(.gnu.version_r)	}
64  .rel.init      : { *(.rel.init)	}
65  .rela.init     : { *(.rela.init)	}
66  .rel.text      :
67    {
68      *(.rel.text)
69      *(.rel.text.*)
70      *(.rel.gnu.linkonce.t.*)
71    }
72  .rela.text     :
73    {
74      *(.rela.text)
75      *(.rela.text.*)
76      *(.rela.gnu.linkonce.t.*)
77    }
78  .rel.fini      : { *(.rel.fini)	}
79  .rela.fini     : { *(.rela.fini)	}
80  .rel.rodata    :
81    {
82      *(.rel.rodata)
83      *(.rel.rodata.*)
84      *(.rel.gnu.linkonce.r.*)
85    }
86  .rela.rodata   :
87    {
88      *(.rela.rodata)
89      *(.rela.rodata.*)
90      *(.rela.gnu.linkonce.r.*)
91    }
92  .rel.data      :
93    {
94      *(.rel.data)
95      *(.rel.data.*)
96      *(.rel.gnu.linkonce.d.*)
97    }
98  .rela.data     :
99    {
100      *(.rela.data)
101      *(.rela.data.*)
102      *(.rela.gnu.linkonce.d.*)
103    }
104  .rel.ctors     : { *(.rel.ctors)	}
105  .rela.ctors    : { *(.rela.ctors)	}
106  .rel.dtors     : { *(.rel.dtors)	}
107  .rela.dtors    : { *(.rela.dtors)	}
108  .rel.got       : { *(.rel.got)		}
109  .rela.got      : { *(.rela.got)		}
110  .rel.sdata     :
111    {
112      *(.rel.sdata)
113      *(.rel.sdata.*)
114      *(.rel.gnu.linkonce.s.*)
115    }
116  .rela.sdata     :
117    {
118      *(.rela.sdata)
119      *(.rela.sdata.*)
120      *(.rela.gnu.linkonce.s.*)
121    }
122  .rel.sbss      :
123    { 
124      *(.rel.sbss)
125      *(.rel.sbss.*)
126      *(.rel.gnu.linkonce.sb.*)
127    }
128  .rela.sbss     :
129    {
130      *(.rela.sbss)
131      *(.rela.sbss.*)
132      *(.rel.gnu.linkonce.sb.*)
133    }
134  .rel.sdata2    : 
135    { 
136      *(.rel.sdata2)
137      *(.rel.sdata2.*)
138      *(.rel.gnu.linkonce.s2.*)
139    }
140  .rela.sdata2   : 
141    {
142      *(.rela.sdata2)
143      *(.rela.sdata2.*)
144      *(.rela.gnu.linkonce.s2.*)
145    }
146  .rel.sbss2     : 
147    { 
148      *(.rel.sbss2)	
149      *(.rel.sbss2.*)
150      *(.rel.gnu.linkonce.sb2.*)
151    }
152  .rela.sbss2    : 
153    { 
154      *(.rela.sbss2)	
155      *(.rela.sbss2.*)
156      *(.rela.gnu.linkonce.sb2.*)
157    }
158  .rel.bss       : 
159    { 
160      *(.rel.bss)
161      *(.rel.bss.*)
162      *(.rel.gnu.linkonce.b.*)
163    }
164  .rela.bss      : 
165    { 
166      *(.rela.bss)
167      *(.rela.bss.*)
168      *(.rela.gnu.linkonce.b.*)
169    }
170  .rel.plt       : { *(.rel.plt)		}
171  .rela.plt      : { *(.rela.plt)		}
172  .init          : 
173  { 
174    KEEP (*(.init))
175  } :text =0x1000000
176  .text      :
177  {
178    *(.trap)
179    *(.text)
180    *(.text.*)
181    *(.stub)
182    /* .gnu.warning sections are handled specially by elf32.em.  */
183    *(.gnu.warning)
184    *(.gnu.linkonce.t.*)
185  } =0x1000000
186  .fini      :
187  {
188    KEEP (*(.fini))
189  } =0x1000000
190  PROVIDE (__etext = .);
191  PROVIDE (_etext = .);
192  PROVIDE (etext = .);
193  .rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) }
194  .rodata1   : { *(.rodata1) }
195  .reginfo : { *(.reginfo) }
196  .sdata2   : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) }
197  .sbss2   : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) }
198  . = ALIGN(0x2000) + (. & (0x2000 - 1));
199  .data    :
200  {
201    *(.data)
202    *(.data.*)
203    *(.gnu.linkonce.d.*)
204  } :data
205  .data1   : { *(.data1) }
206  .eh_frame : { KEEP (*(.eh_frame)) }
207  .gcc_except_table : { *(.gcc_except_table) }
208  .ctors   : 
209  {
210    /* gcc uses crtbegin.o to find the start of
211       the constructors, so we make sure it is
212       first.  Because this is a wildcard, it
213       doesn't matter if the user does not
214       actually link against crtbegin.o; the
215       linker won't look for a file to match a
216       wildcard.  The wildcard also means that it
217       doesn't matter which directory crtbegin.o
218       is in.  */
219    KEEP (*crtbegin.o(.ctors))
220    /* We don't want to include the .ctor section from
221       from the crtend.o file until after the sorted ctors.
222       The .ctor section from the crtend file contains the
223       end of ctors marker and it must be last */
224    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
225    KEEP (*(SORT(.ctors.*)))
226    KEEP (*(.ctors))
227  }
228   .dtors         :
229  {
230    KEEP (*crtbegin.o(.dtors))
231    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
232    KEEP (*(SORT(.dtors.*)))
233    KEEP (*(.dtors))
234  }
235  .plt      : { *(.plt)	}
236  _gp = ALIGN(16) + 0x7ff0;
237  .got		  : { *(.got.plt) *(.got) }
238  .dynamic       : { *(.dynamic) } :dynamic
239  /* We want the small data sections together, so single-instruction offsets
240     can access them all, and initialized data all before uninitialized, so
241     we can shorten the on-disk segment size.  */
242  .sdata     : 
243  {
244    *(.sdata) 
245    *(.sdata.*)
246    *(.gnu.linkonce.s.*)
247  }
248  _edata = .;
249  PROVIDE (edata = .);
250  __bss_start = .;
251  .sbss      :
252  {
253    PROVIDE (__sbss_start = .);
254    PROVIDE (___sbss_start = .);
255    *(.dynsbss)
256    *(.sbss)
257    *(.sbss.*)
258    *(.gnu.linkonce.sb.*)
259    *(.scommon)
260    PROVIDE (__sbss_end = .);
261    PROVIDE (___sbss_end = .);
262  }
263  .bss       :
264  {
265   *(.dynbss)
266   *(.bss)
267   *(.bss.*)
268   *(.gnu.linkonce.b.*)
269   *(COMMON)
270   /* Align here to ensure that the .bss section occupies space up to
271      _end.  Align after .bss to ensure correct alignment even if the
272      .bss section disappears because there are no input sections.  */
273   . = ALIGN(64 / 8);
274  }
275  . = ALIGN(64 / 8);
276  _end = .;
277  PROVIDE (end = .);
278  /* Stabs debugging sections.  */
279  .stab 0 : { *(.stab) }
280  .stabstr 0 : { *(.stabstr) }
281  .stab.excl 0 : { *(.stab.excl) }
282  .stab.exclstr 0 : { *(.stab.exclstr) }
283  .stab.index 0 : { *(.stab.index) }
284  .stab.indexstr 0 : { *(.stab.indexstr) }
285  .comment 0 : { *(.comment) }
286  /* DWARF debug sections.
287     Symbols in the DWARF debugging sections are relative to the beginning
288     of the section so we begin them at 0.  */
289  /* DWARF 1 */
290  .debug          0 : { *(.debug) }
291  .line           0 : { *(.line) }
292  /* GNU DWARF 1 extensions */
293  .debug_srcinfo  0 : { *(.debug_srcinfo) }
294  .debug_sfnames  0 : { *(.debug_sfnames) }
295  /* DWARF 1.1 and DWARF 2 */
296  .debug_aranges  0 : { *(.debug_aranges) }
297  .debug_pubnames 0 : { *(.debug_pubnames) }
298  /* DWARF 2 */
299  .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
300  .debug_abbrev   0 : { *(.debug_abbrev) }
301  .debug_line     0 : { *(.debug_line) }
302  .debug_frame    0 : { *(.debug_frame) }
303  .debug_str      0 : { *(.debug_str) }
304  .debug_loc      0 : { *(.debug_loc) }
305  .debug_macinfo  0 : { *(.debug_macinfo) }
306  /* SGI/MIPS DWARF 2 extensions */
307  .debug_weaknames 0 : { *(.debug_weaknames) }
308  .debug_funcnames 0 : { *(.debug_funcnames) }
309  .debug_typenames 0 : { *(.debug_typenames) }
310  .debug_varnames  0 : { *(.debug_varnames) }
311  /* These must appear regardless of  .  */
312}
313