1 /***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
46 * This was created from a template supplied by GNU binutils.
47 * Copyright (C) 2005 Cavium Inc.
52 * This linker script for use in building simple executive application to run
53 * under Linux in userspace. The important difference from a standard Linux
54 * binary is the addition of the ".cvmx_shared" memory section. This script
55 * adds two symbols __cvmx_shared_start and __cvmx_shared_end before and after
56 * the CVMX_SHARED data. These are used by cvmx-app-init-linux.c to create a
57 * shared region across all application processes.
59 * The original template for this files was:
60 * ${OCTEON_ROOT}/tools/mips64-octeon-linux-gnu/lib/ldscripts/elf32btsmipn32.x
62 OUTPUT_FORMAT("elf32-ntradbigmips", "elf32-ntradbigmips",
63 "elf32-ntradlittlemips")
66 SEARCH_DIR("${OCTEON_ROOT}/tools/mips64-octeon-linux-gnu/lib");
69 /* Read-only sections, merged into text segment: */
70 PROVIDE (__executable_start = 0x10000000); . = 0x10000000 + SIZEOF_HEADERS;
71 .interp : { *(.interp) }
72 .reginfo : { *(.reginfo) }
73 .note.gnu.build-id : { *(.note.gnu.build-id) }
74 .dynamic : { *(.dynamic) }
76 .gnu.hash : { *(.gnu.hash) }
77 .dynsym : { *(.dynsym) }
78 .dynstr : { *(.dynstr) }
79 .gnu.version : { *(.gnu.version) }
80 .gnu.version_d : { *(.gnu.version_d) }
81 .gnu.version_r : { *(.gnu.version_r) }
82 .rel.init : { *(.rel.init) }
83 .rela.init : { *(.rela.init) }
84 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
85 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
86 .rel.fini : { *(.rel.fini) }
87 .rela.fini : { *(.rela.fini) }
88 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
89 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
90 .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
91 .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
92 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
93 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
94 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
95 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
96 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
97 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
98 .rel.ctors : { *(.rel.ctors) }
99 .rela.ctors : { *(.rela.ctors) }
100 .rel.dtors : { *(.rel.dtors) }
101 .rela.dtors : { *(.rela.dtors) }
102 .rel.got : { *(.rel.got) }
103 .rela.got : { *(.rela.got) }
104 .rel.dyn : { *(.rel.dyn) }
105 .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
106 .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
107 .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
108 .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
109 .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
110 .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
111 .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
112 .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
113 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
114 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
115 .rel.plt : { *(.rel.plt) }
116 .rela.plt : { *(.rela.plt) }
125 *(.text .stub .text.* .gnu.linkonce.t.*)
126 /* .gnu.warning sections are handled specially by elf32.em. */
128 *(.mips16.fn.*) *(.mips16.call.*)
134 PROVIDE (__etext = .);
135 PROVIDE (_etext = .);
137 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
138 .rodata1 : { *(.rodata1) }
141 *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
143 .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
144 .eh_frame_hdr : { *(.eh_frame_hdr) }
145 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
146 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
147 /* Adjust the address for the data segment. We want to adjust up to
148 the same address within the page on the next page up. */
149 . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
150 /* Exception handling */
151 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
152 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
153 /* Thread Local Storage sections */
154 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
155 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
158 PROVIDE_HIDDEN (__preinit_array_start = .);
159 KEEP (*(.preinit_array))
160 PROVIDE_HIDDEN (__preinit_array_end = .);
164 PROVIDE_HIDDEN (__init_array_start = .);
165 KEEP (*(SORT(.init_array.*)))
166 KEEP (*(.init_array))
167 PROVIDE_HIDDEN (__init_array_end = .);
171 PROVIDE_HIDDEN (__fini_array_start = .);
172 KEEP (*(.fini_array))
173 KEEP (*(SORT(.fini_array.*)))
174 PROVIDE_HIDDEN (__fini_array_end = .);
178 /* gcc uses crtbegin.o to find the start of
179 the constructors, so we make sure it is
180 first. Because this is a wildcard, it
181 doesn't matter if the user does not
182 actually link against crtbegin.o; the
183 linker won't look for a file to match a
184 wildcard. The wildcard also means that it
185 doesn't matter which directory crtbegin.o
187 KEEP (*crtbegin.o(.ctors))
188 KEEP (*crtbegin?.o(.ctors))
189 /* We don't want to include the .ctor section from
190 the crtend.o file until after the sorted ctors.
191 The .ctor section from the crtend file contains the
192 end of ctors marker and it must be last */
193 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
194 KEEP (*(SORT(.ctors.*)))
199 KEEP (*crtbegin.o(.dtors))
200 KEEP (*crtbegin?.o(.dtors))
201 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
202 KEEP (*(SORT(.dtors.*)))
205 .jcr : { KEEP (*(.jcr)) }
206 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
207 . = DATA_SEGMENT_RELRO_END (0, .);
211 *(.data .data.* .gnu.linkonce.d.*)
214 .data1 : { *(.data1) }
215 .got.plt : { *(.got.plt) }
217 _gp = ALIGN(16) + 0x7ff0;
219 /* We want the small data sections together, so single-instruction offsets
220 can access them all, and initialized data all before uninitialized, so
221 we can shorten the on-disk segment size. */
224 *(.sdata .sdata.* .gnu.linkonce.s.*)
228 .srdata : { *(.srdata) }
231 __cvmx_shared_start = .;
232 .cvmx_shared : {*(.cvmx_shared .cvmx_shared.linkonce.*)}
233 .cvmx_shared_bss : { *(.cvmx_shared_bss .cvmx_shared_bss.linkonce.*) }
235 __cvmx_shared_end = .;
237 _edata = .; PROVIDE (edata = .);
242 PROVIDE (__sbss_start = .);
243 PROVIDE (___sbss_start = .);
245 *(.sbss .sbss.* .gnu.linkonce.sb.*)
247 PROVIDE (__sbss_end = .);
248 PROVIDE (___sbss_end = .);
253 *(.bss .bss.* .gnu.linkonce.b.*)
255 /* Align here to ensure that the .bss section occupies space up to
256 _end. Align after .bss to ensure correct alignment even if the
257 .bss section disappears because there are no input sections.
258 FIXME: Why do we need it? When there is no .bss section, we don't
259 pad the .data section. */
260 . = ALIGN(. != 0 ? 32 / 8 : 1);
263 . = ALIGN(32M); /* RBF added alignment of data */
264 .cvmx_shared : { *(.cvmx_shared) }
265 _end = .; PROVIDE (end = .);
266 . = DATA_SEGMENT_END (.);
267 /* Stabs debugging sections. */
268 .stab 0 : { *(.stab) }
269 .stabstr 0 : { *(.stabstr) }
270 .stab.excl 0 : { *(.stab.excl) }
271 .stab.exclstr 0 : { *(.stab.exclstr) }
272 .stab.index 0 : { *(.stab.index) }
273 .stab.indexstr 0 : { *(.stab.indexstr) }
274 .comment 0 : { *(.comment) }
275 /* DWARF debug sections.
276 Symbols in the DWARF debugging sections are relative to the beginning
277 of the section so we begin them at 0. */
279 .debug 0 : { *(.debug) }
280 .line 0 : { *(.line) }
281 /* GNU DWARF 1 extensions */
282 .debug_srcinfo 0 : { *(.debug_srcinfo) }
283 .debug_sfnames 0 : { *(.debug_sfnames) }
284 /* DWARF 1.1 and DWARF 2 */
285 .debug_aranges 0 : { *(.debug_aranges) }
286 .debug_pubnames 0 : { *(.debug_pubnames) }
288 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
289 .debug_abbrev 0 : { *(.debug_abbrev) }
290 .debug_line 0 : { *(.debug_line) }
291 .debug_frame 0 : { *(.debug_frame) }
292 .debug_str 0 : { *(.debug_str) }
293 .debug_loc 0 : { *(.debug_loc) }
294 .debug_macinfo 0 : { *(.debug_macinfo) }
295 /* SGI/MIPS DWARF 2 extensions */
296 .debug_weaknames 0 : { *(.debug_weaknames) }
297 .debug_funcnames 0 : { *(.debug_funcnames) }
298 .debug_typenames 0 : { *(.debug_typenames) }
299 .debug_varnames 0 : { *(.debug_varnames) }
301 .debug_pubtypes 0 : { *(.debug_pubtypes) }
302 .debug_ranges 0 : { *(.debug_ranges) }
303 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
304 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
305 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
306 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }