[444] | 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 | ENTRY(_start) |
---|
| 8 | OUTPUT_ARCH("mips:isa64r2") |
---|
| 9 | OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips", "elf32-tradlittlemips") |
---|
| 10 | GROUP(-lc -lidt -lgcc) |
---|
| 11 | SEARCH_DIR(.) |
---|
| 12 | __DYNAMIC = 0; |
---|
| 13 | STARTUP(crt0.o) |
---|
| 14 | |
---|
| 15 | /* |
---|
| 16 | * Allocate the stack to be at the top of memory, since the stack |
---|
| 17 | * grows down |
---|
| 18 | */ |
---|
| 19 | PROVIDE (__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 | */ |
---|
| 30 | PROVIDE (hardware_exit_hook = 0); |
---|
| 31 | PROVIDE (hardware_hazard_hook = 0); |
---|
| 32 | PROVIDE (hardware_init_hook = 0); |
---|
| 33 | PROVIDE (software_init_hook = 0); |
---|
| 34 | |
---|
| 35 | SECTIONS |
---|
| 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 | .MIPS.abiflags : { |
---|
| 99 | __MIPS_abiflags_start = .; |
---|
| 100 | *(.MIPS.abiflags) |
---|
| 101 | __MIPS_abiflags_end = .; |
---|
| 102 | } |
---|
| 103 | .rodata : { |
---|
| 104 | *(.rdata) |
---|
| 105 | *(.rodata) |
---|
| 106 | *(.rodata.*) |
---|
| 107 | *(.gnu.linkonce.r.*) |
---|
| 108 | } |
---|
| 109 | _fdata = ALIGN(16); |
---|
| 110 | .data : { |
---|
| 111 | *(.data) |
---|
| 112 | *(.data.*) |
---|
| 113 | *(.gnu.linkonce.d.*) |
---|
| 114 | } |
---|
| 115 | . = ALIGN(8); |
---|
| 116 | _gp = . + 0x8000; |
---|
| 117 | __global = _gp; |
---|
| 118 | .lit8 : { |
---|
| 119 | *(.lit8) |
---|
| 120 | } |
---|
| 121 | .lit4 : { |
---|
| 122 | *(.lit4) |
---|
| 123 | } |
---|
| 124 | .sdata : { |
---|
| 125 | *(.sdata) |
---|
| 126 | *(.sdata.*) |
---|
| 127 | *(.gnu.linkonce.s.*) |
---|
| 128 | } |
---|
| 129 | . = ALIGN(4); |
---|
| 130 | PROVIDE (edata = .); |
---|
| 131 | _edata = .; |
---|
| 132 | _fbss = .; |
---|
| 133 | .sbss : { |
---|
| 134 | *(.sbss) |
---|
| 135 | *(.sbss.*) |
---|
| 136 | *(.gnu.linkonce.sb.*) |
---|
| 137 | *(.scommon) |
---|
| 138 | } |
---|
| 139 | .bss : { |
---|
| 140 | _bss_start = . ; |
---|
| 141 | *(.bss) |
---|
| 142 | *(.bss.*) |
---|
| 143 | *(.gnu.linkonce.b.*) |
---|
| 144 | *(COMMON) |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | . = ALIGN(4); |
---|
| 148 | PROVIDE (end = .); |
---|
| 149 | _end = .; |
---|
| 150 | |
---|
| 151 | /* DWARF debug sections. |
---|
| 152 | Symbols in the DWARF debugging sections are relative to |
---|
| 153 | the beginning of the section so we begin them at 0. */ |
---|
| 154 | |
---|
| 155 | /* DWARF 1 */ |
---|
| 156 | .debug 0 : { *(.debug) } |
---|
| 157 | .line 0 : { *(.line) } |
---|
| 158 | |
---|
| 159 | /* GNU DWARF 1 extensions */ |
---|
| 160 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
| 161 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
| 162 | |
---|
| 163 | /* DWARF 1.1 and DWARF 2 */ |
---|
| 164 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
| 165 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
| 166 | |
---|
| 167 | /* DWARF 2 */ |
---|
| 168 | .debug_info 0 : { *(.debug_info) } |
---|
| 169 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
| 170 | .debug_line 0 : { *(.debug_line) } |
---|
| 171 | .debug_frame 0 : { *(.debug_frame) } |
---|
| 172 | .debug_str 0 : { *(.debug_str) } |
---|
| 173 | .debug_loc 0 : { *(.debug_loc) } |
---|
| 174 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
| 175 | .debug_ranges 0 : { *(.debug_ranges) } |
---|
| 176 | |
---|
| 177 | /* SGI/MIPS DWARF 2 extensions */ |
---|
| 178 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
| 179 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
| 180 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
| 181 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
| 182 | |
---|
| 183 | /* Special sections generated by gcc */ |
---|
| 184 | /* Newer GNU linkers strip by default */ |
---|
| 185 | .mdebug.abi32 0 : { KEEP(*(.mdebug.abi32)) } |
---|
| 186 | .mdebug.abiN32 0 : { KEEP(*(.mdebug.abiN32)) } |
---|
| 187 | .mdebug.abi64 0 : { KEEP(*(.mdebug.abi64)) } |
---|
| 188 | .mdebug.abiO64 0 : { KEEP(*(.mdebug.abiO64)) } |
---|
| 189 | .mdebug.eabi32 0 : { KEEP(*(.mdebug.eabi32)) } |
---|
| 190 | .mdebug.eabi64 0 : { KEEP(*(.mdebug.eabi64)) } |
---|
| 191 | .gcc_compiled_long32 0 : { KEEP(*(.gcc_compiled_long32)) } |
---|
| 192 | .gcc_compiled_long64 0 : { KEEP(*(.gcc_compiled_long64)) } |
---|
| 193 | } |
---|