1163953Srrs/***********************license start*************** 2169382Srrs * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights 3235828Stuexen * reserved. 4235828Stuexen * 5163953Srrs * 6163953Srrs * Redistribution and use in source and binary forms, with or without 7163953Srrs * modification, are permitted provided that the following conditions are 8163953Srrs * met: 9163953Srrs * 10228653Stuexen * * Redistributions of source code must retain the above copyright 11163953Srrs * notice, this list of conditions and the following disclaimer. 12163953Srrs * 13163953Srrs * * Redistributions in binary form must reproduce the above 14228653Stuexen * copyright notice, this list of conditions and the following 15163953Srrs * disclaimer in the documentation and/or other materials provided 16163953Srrs * with the distribution. 17163953Srrs 18163953Srrs * * Neither the name of Cavium Inc. nor the names of 19163953Srrs * its contributors may be used to endorse or promote products 20163953Srrs * derived from this software without specific prior written 21163953Srrs * permission. 22163953Srrs 23163953Srrs * This Software, including technical data, may be subject to U.S. export control 24163953Srrs * laws, including the U.S. Export Administration Act and its associated 25163953Srrs * regulations, and may be subject to export or import regulations in other 26163953Srrs * countries. 27163953Srrs 28163953Srrs * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 29163953Srrs * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR 30163953Srrs * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO 31163953Srrs * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR 32163953Srrs * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM 33163953Srrs * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, 34163953Srrs * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF 35163953Srrs * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR 36235828Stuexen * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR 37235828Stuexen * PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 38163953Srrs ***********************license end**************************************/ 39180387Srrs 40169378Srrs 41163953Srrs 42237715Stuexen 43237049Stuexen 44238003Stuexen 45238003Stuexen/* 46238003Stuexen * This was created from a template supplied by GNU binutils. 47238003Stuexen * Copyright (C) 2004 Cavium Inc. 48284633Stuexen */ 49237049Stuexen 50163953Srrs/** 51273275Stuexen * @file 52169352Srrs * This linker script for use in building simple executive application to run 53169352Srrs * under Linux in userspace. The important difference from a standard Linux 54163953Srrs * binary is the addition of the ".cvmx_shared" memory section. This script 55169352Srrs * adds two symbols __cvmx_shared_start and __cvmx_sahred_end before and after 56240198Stuexen * the CVMX_SHARED data. These are used by cvmx-app-init-linux.c to create a 57169352Srrs * shared region across all application processes. 58163953Srrs * 59171158Srrs * The original template for this files was: 60221627Stuexen * ${OCTEON_ROOT}/tools/mips64-octeon-linux-gnu/lib/ldscripts/elf32btsmip.x 61171158Srrs */ 62163953SrrsOUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", 63163953Srrs "elf32-tradlittlemips") 64OUTPUT_ARCH(mips) 65ENTRY(__start) 66SEARCH_DIR("${OCTEON_ROOT}/tools/mips64-octeon-linux-gnu/lib"); 67/* Do we need any of these for elf? 68 __DYNAMIC = 0; */ 69SECTIONS 70{ 71 /* Read-only sections, merged into text segment: */ 72 PROVIDE (__executable_start = 0x10000000); . = 0x10000000 + SIZEOF_HEADERS; 73 .interp : { *(.interp) } 74 .reginfo : { *(.reginfo) } 75 .dynamic : { *(.dynamic) } 76 .hash : { *(.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.data .rel.data.* .rel.gnu.linkonce.d.*) } 91 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 92 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 93 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 94 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 95 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 96 .rel.ctors : { *(.rel.ctors) } 97 .rela.ctors : { *(.rela.ctors) } 98 .rel.dtors : { *(.rel.dtors) } 99 .rela.dtors : { *(.rela.dtors) } 100 .rel.got : { *(.rel.got) } 101 .rela.got : { *(.rela.got) } 102 .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } 103 .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } 104 .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } 105 .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } 106 .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } 107 .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } 108 .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } 109 .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } 110 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 111 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 112 .rel.plt : { *(.rel.plt) } 113 .rela.plt : { *(.rela.plt) } 114 .init : 115 { 116 KEEP (*(.init)) 117 } =0 118 .plt : { *(.plt) } 119 .text : 120 { 121 _ftext = . ; 122 *(.text .stub .text.* .gnu.linkonce.t.*) 123 /* .gnu.warning sections are handled specially by elf32.em. */ 124 *(.gnu.warning) 125 *(.mips16.fn.*) *(.mips16.call.*) 126 } =0 127 .fini : 128 { 129 KEEP (*(.fini)) 130 } =0 131 PROVIDE (__etext = .); 132 PROVIDE (_etext = .); 133 PROVIDE (etext = .); 134 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 135 .rodata1 : { *(.rodata1) } 136 .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } 137 .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } 138 .eh_frame_hdr : { *(.eh_frame_hdr) } 139 /* Adjust the address for the data segment. We want to adjust up to 140 the same address within the page on the next page up. */ 141 . = 0x10000000; 142 /* Ensure the __preinit_array_start label is properly aligned. We 143 could instead move the label definition inside the section, but 144 the linker would then create the section even if it turns out to 145 be empty, which isn't pretty. */ 146 . = ALIGN(32 / 8); 147 PROVIDE (__preinit_array_start = .); 148 .preinit_array : { *(.preinit_array) } 149 PROVIDE (__preinit_array_end = .); 150 PROVIDE (__init_array_start = .); 151 .init_array : { *(.init_array) } 152 PROVIDE (__init_array_end = .); 153 PROVIDE (__fini_array_start = .); 154 .fini_array : { *(.fini_array) } 155 PROVIDE (__fini_array_end = .); 156 .data : 157 { 158 _fdata = . ; 159 *(.data .data.* .gnu.linkonce.d.*) 160 SORT(CONSTRUCTORS) 161 } 162 .data1 : { *(.data1) } 163 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 164 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 165 .eh_frame : { KEEP (*(.eh_frame)) } 166 .gcc_except_table : { *(.gcc_except_table) } 167 .ctors : 168 { 169 /* gcc uses crtbegin.o to find the start of 170 the constructors, so we make sure it is 171 first. Because this is a wildcard, it 172 doesn't matter if the user does not 173 actually link against crtbegin.o; the 174 linker won't look for a file to match a 175 wildcard. The wildcard also means that it 176 doesn't matter which directory crtbegin.o 177 is in. */ 178 KEEP (*crtbegin*.o(.ctors)) 179 /* We don't want to include the .ctor section from 180 from the crtend.o file until after the sorted ctors. 181 The .ctor section from the crtend file contains the 182 end of ctors marker and it must be last */ 183 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) 184 KEEP (*(SORT(.ctors.*))) 185 KEEP (*(.ctors)) 186 } 187 .dtors : 188 { 189 KEEP (*crtbegin*.o(.dtors)) 190 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) 191 KEEP (*(SORT(.dtors.*))) 192 KEEP (*(.dtors)) 193 } 194 .jcr : { KEEP (*(.jcr)) } 195 _gp = ALIGN(16) + 0x7ff0; 196 .got : { *(.got.plt) *(.got) } 197 /* We want the small data sections together, so single-instruction offsets 198 can access them all, and initialized data all before uninitialized, so 199 we can shorten the on-disk segment size. */ 200 .sdata : 201 { 202 *(.sdata .sdata.* .gnu.linkonce.s.*) 203 } 204 .lit8 : { *(.lit8) } 205 .lit4 : { *(.lit4) } 206 207 . = ALIGN (0x10000); 208 __cvmx_shared_start = .; 209 .cvmx_shared : {*(.cvmx_shared .cvmx_shared.linkonce.*)} 210 .cvmx_shared_bss : {*(.cvmx_shared_bss .cvmx_shared_bss.linkonce.*)} 211 . = ALIGN (0x10000); 212 __cvmx_shared_end = .; 213 214 _edata = .; 215 PROVIDE (edata = .); 216 __bss_start = .; 217 _fbss = .; 218 .sbss : 219 { 220 PROVIDE (__sbss_start = .); 221 PROVIDE (___sbss_start = .); 222 *(.dynsbss) 223 *(.sbss .sbss.* .gnu.linkonce.sb.*) 224 *(.scommon) 225 PROVIDE (__sbss_end = .); 226 PROVIDE (___sbss_end = .); 227 } 228 .bss : 229 { 230 *(.dynbss) 231 *(.bss .bss.* .gnu.linkonce.b.*) 232 *(COMMON) 233 /* Align here to ensure that the .bss section occupies space up to 234 _end. Align after .bss to ensure correct alignment even if the 235 .bss section disappears because there are no input sections. */ 236 . = ALIGN(32 / 8); 237 } 238 . = ALIGN(32 / 8); 239 . = ALIGN(32M); /* RBF added alignment of data */ 240 .cvmx_shared : { *(.cvmx_shared) } 241 _end = .; 242 PROVIDE (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. */ 254 /* DWARF 1 */ 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) } 263 /* DWARF 2 */ 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) } 279} 280