1 /***********************license start***************
2 * Copyright (c) 2003-2008 Cavium Networks (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 Networks 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 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
24 * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
25 * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
26 * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
27 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
28 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
29 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
30 * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
31 * POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
32 * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
35 * For any questions regarding licensing please contact marketing@caviumnetworks.com
37 ***********************license end**************************************/
44 * This was created from a template supplied by GNU binutils.
45 * Copyright (C) 2005 Cavium Networks
50 * This linker script for use in building simple executive application to run
51 * under Linux in userspace. The important difference from a standard Linux
52 * binary is the addition of the ".cvmx_shared" memory section. This script
53 * adds two symbols __cvmx_shared_start and __cvmx_shared_end before and after
54 * the CVMX_SHARED data. These are used by cvmx-app-init-linux.c to create a
55 * shared region across all application processes.
57 * The original template for this files was:
58 * ${OCTEON_ROOT}/tools/mips64-octeon-linux-gnu/lib/ldscripts/elf32btsmipn32.x
60 OUTPUT_FORMAT("elf32-ntradbigmips", "elf32-ntradbigmips",
61 "elf32-ntradlittlemips")
64 SEARCH_DIR("${OCTEON_ROOT}/tools/mips64-octeon-linux-gnu/lib");
65 /* Do we need any of these for elf?
69 /* Read-only sections, merged into text segment: */
70 PROVIDE (__executable_start = 0x10000000); . = 0x10000000 + SIZEOF_HEADERS;
71 .interp : { *(.interp) }
72 .MIPS.options : { *(.MIPS.options) }
73 .dynamic : { *(.dynamic) }
75 .dynsym : { *(.dynsym) }
76 .dynstr : { *(.dynstr) }
77 .gnu.version : { *(.gnu.version) }
78 .gnu.version_d : { *(.gnu.version_d) }
79 .gnu.version_r : { *(.gnu.version_r) }
80 .rel.init : { *(.rel.init) }
81 .rela.init : { *(.rela.init) }
82 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
83 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
84 .rel.fini : { *(.rel.fini) }
85 .rela.fini : { *(.rela.fini) }
86 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
87 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
88 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
89 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
90 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
91 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
92 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
93 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
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 : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
101 .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
102 .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
103 .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
104 .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
105 .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
106 .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
107 .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
108 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
109 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
110 .rel.plt : { *(.rel.plt) }
111 .rela.plt : { *(.rela.plt) }
120 *(.text .stub .text.* .gnu.linkonce.t.*)
121 /* .gnu.warning sections are handled specially by elf32.em. */
123 *(.mips16.fn.*) *(.mips16.call.*)
129 PROVIDE (__etext = .);
130 PROVIDE (_etext = .);
132 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
133 .rodata1 : { *(.rodata1) }
134 .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
135 .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
136 .eh_frame_hdr : { *(.eh_frame_hdr) }
137 /* Adjust the address for the data segment. We want to adjust up to
138 the same address within the page on the next page up. */
139 . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);
140 /* Ensure the __preinit_array_start label is properly aligned. We
141 could instead move the label definition inside the section, but
142 the linker would then create the section even if it turns out to
143 be empty, which isn't pretty. */
145 PROVIDE (__preinit_array_start = .);
146 .preinit_array : { *(.preinit_array) }
147 PROVIDE (__preinit_array_end = .);
148 PROVIDE (__init_array_start = .);
149 .init_array : { *(.init_array) }
150 PROVIDE (__init_array_end = .);
151 PROVIDE (__fini_array_start = .);
152 .fini_array : { *(.fini_array) }
153 PROVIDE (__fini_array_end = .);
157 *(.data .data.* .gnu.linkonce.d.*)
160 .data1 : { *(.data1) }
161 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
162 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
163 .eh_frame : { KEEP (*(.eh_frame)) }
164 .gcc_except_table : { *(.gcc_except_table) }
167 /* gcc uses crtbegin.o to find the start of
168 the constructors, so we make sure it is
169 first. Because this is a wildcard, it
170 doesn't matter if the user does not
171 actually link against crtbegin.o; the
172 linker won't look for a file to match a
173 wildcard. The wildcard also means that it
174 doesn't matter which directory crtbegin.o
176 KEEP (*crtbegin*.o(.ctors))
177 /* We don't want to include the .ctor section from
178 from the crtend.o file until after the sorted ctors.
179 The .ctor section from the crtend file contains the
180 end of ctors marker and it must be last */
181 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
182 KEEP (*(SORT(.ctors.*)))
187 KEEP (*crtbegin*.o(.dtors))
188 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
189 KEEP (*(SORT(.dtors.*)))
192 .jcr : { KEEP (*(.jcr)) }
193 _gp = ALIGN(16) + 0x7ff0;
194 .got : { *(.got.plt) *(.got) }
195 /* We want the small data sections together, so single-instruction offsets
196 can access them all, and initialized data all before uninitialized, so
197 we can shorten the on-disk segment size. */
200 *(.sdata .sdata.* .gnu.linkonce.s.*)
204 .srdata : { *(.srdata) }
207 __cvmx_shared_start = .;
208 .cvmx_shared : {*(.cvmx_shared .cvmx_shared.linkonce.*)}
209 .cvmx_shared_bss : { *(.cvmx_shared_bss .cvmx_shared_bss.linkonce.*) }
211 __cvmx_shared_end = .;
219 PROVIDE (__sbss_start = .);
220 PROVIDE (___sbss_start = .);
222 *(.sbss .sbss.* .gnu.linkonce.sb.*)
224 PROVIDE (__sbss_end = .);
225 PROVIDE (___sbss_end = .);
230 *(.bss .bss.* .gnu.linkonce.b.*)
232 /* Align here to ensure that the .bss section occupies space up to
233 _end. Align after .bss to ensure correct alignment even if the
234 .bss section disappears because there are no input sections. */
238 . = ALIGN(32M); /* RBF added alignment of data */
239 .cvmx_shared : { *(.cvmx_shared) }
242 . = DATA_SEGMENT_END (.);
243 /* Stabs debugging sections. */
244 .stab 0 : { *(.stab) }
245 .stabstr 0 : { *(.stabstr) }
246 .stab.excl 0 : { *(.stab.excl) }
247 .stab.exclstr 0 : { *(.stab.exclstr) }
248 .stab.index 0 : { *(.stab.index) }
249 .stab.indexstr 0 : { *(.stab.indexstr) }
250 .comment 0 : { *(.comment) }
251 /* DWARF debug sections.
252 Symbols in the DWARF debugging sections are relative to the beginning
253 of the section so we begin them at 0. */
255 .debug 0 : { *(.debug) }
256 .line 0 : { *(.line) }
257 /* GNU DWARF 1 extensions */
258 .debug_srcinfo 0 : { *(.debug_srcinfo) }
259 .debug_sfnames 0 : { *(.debug_sfnames) }
260 /* DWARF 1.1 and DWARF 2 */
261 .debug_aranges 0 : { *(.debug_aranges) }
262 .debug_pubnames 0 : { *(.debug_pubnames) }
264 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
265 .debug_abbrev 0 : { *(.debug_abbrev) }
266 .debug_line 0 : { *(.debug_line) }
267 .debug_frame 0 : { *(.debug_frame) }
268 .debug_str 0 : { *(.debug_str) }
269 .debug_loc 0 : { *(.debug_loc) }
270 .debug_macinfo 0 : { *(.debug_macinfo) }
271 /* SGI/MIPS DWARF 2 extensions */
272 .debug_weaknames 0 : { *(.debug_weaknames) }
273 .debug_funcnames 0 : { *(.debug_funcnames) }
274 .debug_typenames 0 : { *(.debug_typenames) }
275 .debug_varnames 0 : { *(.debug_varnames) }
276 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
277 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
278 /DISCARD/ : { *(.note.GNU-stack) }