1/* The following TEXT start address leaves space for the monitor 2 workspace. This linker script links ISA64r2 programs for use with the 3 simulator. We set the ISA explicitly so that we can link objects of 4 different ISAs that are subsets of ISA64r2 but are not extensions of 5 each other (e.g., MIPS32r2 and MIPS64). */ 6 7ENTRY(_start) 8OUTPUT_ARCH("mips:isa64r2") 9OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", "elf32-littlemips") 10GROUP(-lc -lidt -lgcc) 11SEARCH_DIR(.) 12__DYNAMIC = 0; 13STARTUP(crt0.o) 14 15/* 16 * Allocate the stack to be at the top of memory, since the stack 17 * grows down 18 */ 19PROVIDE (__stack = 0); 20/* PROVIDE (__global = 0); */ 21 22/* 23 * Initalize some symbols to be zero so we can reference them in the 24 * crt0 without core dumping. These functions are all optional, but 25 * we do this so we can have our crt0 always use them if they exist. 26 * This is so BSPs work better when using the crt0 installed with gcc. 27 * We have to initalize them twice, so we multiple object file 28 * formats, as some prepend an underscore. 29 */ 30PROVIDE (hardware_exit_hook = 0); 31PROVIDE (hardware_hazard_hook = 0); 32PROVIDE (hardware_init_hook = 0); 33PROVIDE (software_init_hook = 0); 34 35SECTIONS 36{ 37 . = 0x80020000; 38 .text : { 39 _ftext = . ; 40 PROVIDE (eprol = .); 41 *(.text) 42 *(.text.*) 43 *(.gnu.linkonce.t.*) 44 *(.mips16.fn.*) 45 *(.mips16.call.*) 46 } 47 .init : { 48 KEEP (*(.init)) 49 } 50 .fini : { 51 KEEP (*(.fini)) 52 } 53 .rel.sdata : { 54 PROVIDE (__runtime_reloc_start = .); 55 *(.rel.sdata) 56 PROVIDE (__runtime_reloc_stop = .); 57 } 58 PROVIDE (etext = .); 59 _etext = .; 60 61 .eh_frame_hdr : { *(.eh_frame_hdr) } 62 .eh_frame : { KEEP (*(.eh_frame)) } 63 .gcc_except_table : { *(.gcc_except_table) } 64 .jcr : { KEEP (*(.jcr)) } 65 .ctors : 66 { 67 /* gcc uses crtbegin.o to find the start of 68 the constructors, so we make sure it is 69 first. Because this is a wildcard, it 70 doesn't matter if the user does not 71 actually link against crtbegin.o; the 72 linker won't look for a file to match a 73 wildcard. The wildcard also means that it 74 doesn't matter which directory crtbegin.o 75 is in. */ 76 77 KEEP (*crtbegin.o(.ctors)) 78 79 /* We don't want to include the .ctor section from 80 from the crtend.o file until after the sorted ctors. 81 The .ctor section from the crtend file contains the 82 end of ctors marker and it must be last */ 83 84 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) 85 KEEP (*(SORT(.ctors.*))) 86 KEEP (*(.ctors)) 87 } 88 89 .dtors : 90 { 91 KEEP (*crtbegin.o(.dtors)) 92 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) 93 KEEP (*(SORT(.dtors.*))) 94 KEEP (*(.dtors)) 95 } 96 97 . = .; 98 .rodata : { 99 *(.rdata) 100 *(.rodata) 101 *(.rodata.*) 102 *(.gnu.linkonce.r.*) 103 } 104 _fdata = ALIGN(16); 105 .data : { 106 *(.data) 107 *(.data.*) 108 *(.gnu.linkonce.d.*) 109 } 110 . = ALIGN(8); 111 _gp = . + 0x8000; 112 __global = _gp; 113 .lit8 : { 114 *(.lit8) 115 } 116 .lit4 : { 117 *(.lit4) 118 } 119 .sdata : { 120 *(.sdata) 121 *(.sdata.*) 122 *(.gnu.linkonce.s.*) 123 } 124 . = ALIGN(4); 125 PROVIDE (edata = .); 126 _edata = .; 127 _fbss = .; 128 .sbss : { 129 *(.sbss) 130 *(.sbss.*) 131 *(.gnu.linkonce.sb.*) 132 *(.scommon) 133 } 134 .bss : { 135 _bss_start = . ; 136 *(.bss) 137 *(.bss.*) 138 *(.gnu.linkonce.b.*) 139 *(COMMON) 140 } 141 142 PROVIDE (end = .); 143 _end = .; 144 145 /* DWARF debug sections. 146 Symbols in the DWARF debugging sections are relative to 147 the beginning of the section so we begin them at 0. */ 148 149 /* DWARF 1 */ 150 .debug 0 : { *(.debug) } 151 .line 0 : { *(.line) } 152 153 /* GNU DWARF 1 extensions */ 154 .debug_srcinfo 0 : { *(.debug_srcinfo) } 155 .debug_sfnames 0 : { *(.debug_sfnames) } 156 157 /* DWARF 1.1 and DWARF 2 */ 158 .debug_aranges 0 : { *(.debug_aranges) } 159 .debug_pubnames 0 : { *(.debug_pubnames) } 160 161 /* DWARF 2 */ 162 .debug_info 0 : { *(.debug_info) } 163 .debug_abbrev 0 : { *(.debug_abbrev) } 164 .debug_line 0 : { *(.debug_line) } 165 .debug_frame 0 : { *(.debug_frame) } 166 .debug_str 0 : { *(.debug_str) } 167 .debug_loc 0 : { *(.debug_loc) } 168 .debug_macinfo 0 : { *(.debug_macinfo) } 169 .debug_ranges 0 : { *(.debug_ranges) } 170 171 /* SGI/MIPS DWARF 2 extensions */ 172 .debug_weaknames 0 : { *(.debug_weaknames) } 173 .debug_funcnames 0 : { *(.debug_funcnames) } 174 .debug_typenames 0 : { *(.debug_typenames) } 175 .debug_varnames 0 : { *(.debug_varnames) } 176 177 /* Special sections generated by gcc */ 178 /* Newer GNU linkers strip by default */ 179 .mdebug.abi32 0 : { KEEP(*(.mdebug.abi32)) } 180 .mdebug.abiN32 0 : { KEEP(*(.mdebug.abiN32)) } 181 .mdebug.abi64 0 : { KEEP(*(.mdebug.abi64)) } 182 .mdebug.abiO64 0 : { KEEP(*(.mdebug.abiO64)) } 183 .mdebug.eabi32 0 : { KEEP(*(.mdebug.eabi32)) } 184 .mdebug.eabi64 0 : { KEEP(*(.mdebug.eabi64)) } 185 .gcc_compiled_long32 0 : { KEEP(*(.gcc_compiled_long32)) } 186 .gcc_compiled_long64 0 : { KEEP(*(.gcc_compiled_long64)) } 187} 188