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