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