root / mips.ld @ 463ce4ae
History | View | Annotate | Download (8.2 kB)
1 | 608e8ce2 | ths | /* Default linker script, for normal executables */ |
---|---|---|---|
2 | 608e8ce2 | ths | OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", |
3 | 608e8ce2 | ths | "elf32-tradlittlemips") |
4 | 608e8ce2 | ths | OUTPUT_ARCH(mips) |
5 | 608e8ce2 | ths | ENTRY(__start) |
6 | 608e8ce2 | ths | SECTIONS |
7 | 608e8ce2 | ths | { |
8 | 608e8ce2 | ths | /* Read-only sections, merged into text segment: */ |
9 | 608e8ce2 | ths | PROVIDE (__executable_start = 0x0400000); . = 0x0400000 + SIZEOF_HEADERS; |
10 | 608e8ce2 | ths | .interp : { *(.interp) } |
11 | 608e8ce2 | ths | .reginfo : { *(.reginfo) } |
12 | 608e8ce2 | ths | .dynamic : { *(.dynamic) } |
13 | 608e8ce2 | ths | .hash : { *(.hash) } |
14 | 608e8ce2 | ths | .dynsym : { *(.dynsym) } |
15 | 608e8ce2 | ths | .dynstr : { *(.dynstr) } |
16 | 608e8ce2 | ths | .gnu.version : { *(.gnu.version) } |
17 | 608e8ce2 | ths | .gnu.version_d : { *(.gnu.version_d) } |
18 | 608e8ce2 | ths | .gnu.version_r : { *(.gnu.version_r) } |
19 | 608e8ce2 | ths | .rel.init : { *(.rel.init) } |
20 | 608e8ce2 | ths | .rela.init : { *(.rela.init) } |
21 | 608e8ce2 | ths | .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } |
22 | 608e8ce2 | ths | .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } |
23 | 608e8ce2 | ths | .rel.fini : { *(.rel.fini) } |
24 | 608e8ce2 | ths | .rela.fini : { *(.rela.fini) } |
25 | 608e8ce2 | ths | .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } |
26 | 608e8ce2 | ths | .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } |
27 | 608e8ce2 | ths | .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } |
28 | 608e8ce2 | ths | .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } |
29 | 608e8ce2 | ths | .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } |
30 | 608e8ce2 | ths | .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } |
31 | 608e8ce2 | ths | .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } |
32 | 608e8ce2 | ths | .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } |
33 | 608e8ce2 | ths | .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } |
34 | 608e8ce2 | ths | .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } |
35 | 608e8ce2 | ths | .rel.ctors : { *(.rel.ctors) } |
36 | 608e8ce2 | ths | .rela.ctors : { *(.rela.ctors) } |
37 | 608e8ce2 | ths | .rel.dtors : { *(.rel.dtors) } |
38 | 608e8ce2 | ths | .rela.dtors : { *(.rela.dtors) } |
39 | 608e8ce2 | ths | .rel.got : { *(.rel.got) } |
40 | 608e8ce2 | ths | .rela.got : { *(.rela.got) } |
41 | 608e8ce2 | ths | .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } |
42 | 608e8ce2 | ths | .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } |
43 | 608e8ce2 | ths | .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } |
44 | 608e8ce2 | ths | .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } |
45 | 608e8ce2 | ths | .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } |
46 | 608e8ce2 | ths | .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } |
47 | 608e8ce2 | ths | .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } |
48 | 608e8ce2 | ths | .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } |
49 | 608e8ce2 | ths | .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } |
50 | 608e8ce2 | ths | .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } |
51 | 608e8ce2 | ths | .rel.plt : { *(.rel.plt) } |
52 | 608e8ce2 | ths | .rela.plt : { *(.rela.plt) } |
53 | 608e8ce2 | ths | .init : |
54 | 608e8ce2 | ths | { |
55 | 608e8ce2 | ths | KEEP (*(.init)) |
56 | 608e8ce2 | ths | } =0x47ff041f |
57 | 608e8ce2 | ths | .plt : { *(.plt) } |
58 | 608e8ce2 | ths | .text : |
59 | 608e8ce2 | ths | { |
60 | 608e8ce2 | ths | _ftext = . ; |
61 | 608e8ce2 | ths | *(.text .stub .text.* .gnu.linkonce.t.*) |
62 | 608e8ce2 | ths | KEEP (*(.text.*personality*)) |
63 | 608e8ce2 | ths | /* .gnu.warning sections are handled specially by elf32.em. */ |
64 | 608e8ce2 | ths | *(.gnu.warning) |
65 | 608e8ce2 | ths | *(.mips16.fn.*) *(.mips16.call.*) |
66 | 608e8ce2 | ths | } =0x47ff041f |
67 | 608e8ce2 | ths | .fini : |
68 | 608e8ce2 | ths | { |
69 | 608e8ce2 | ths | KEEP (*(.fini)) |
70 | 608e8ce2 | ths | } =0x47ff041f |
71 | 608e8ce2 | ths | PROVIDE (__etext = .); |
72 | 608e8ce2 | ths | PROVIDE (_etext = .); |
73 | 608e8ce2 | ths | PROVIDE (etext = .); |
74 | 608e8ce2 | ths | .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } |
75 | 608e8ce2 | ths | .rodata1 : { *(.rodata1) } |
76 | 608e8ce2 | ths | .sdata2 : |
77 | 608e8ce2 | ths | { |
78 | 608e8ce2 | ths | *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) |
79 | 608e8ce2 | ths | } |
80 | 608e8ce2 | ths | .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } |
81 | 608e8ce2 | ths | .eh_frame_hdr : { *(.eh_frame_hdr) } |
82 | 608e8ce2 | ths | /* Adjust the address for the data segment. We want to adjust up to |
83 | 608e8ce2 | ths | the same address within the page on the next page up. */ |
84 | 608e8ce2 | ths | . = ALIGN (0x40000) - ((0x40000 - .) & (0x40000 - 1)); . = DATA_SEGMENT_ALIGN (0x40000, 0x1000); |
85 | 608e8ce2 | ths | /* Exception handling */ |
86 | 8733f609 | Gerd Hoffmann | .eh_frame : { KEEP (*(.eh_frame)) } |
87 | 8733f609 | Gerd Hoffmann | .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) } |
88 | 608e8ce2 | ths | /* Thread Local Storage sections */ |
89 | 608e8ce2 | ths | .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } |
90 | 608e8ce2 | ths | .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } |
91 | 608e8ce2 | ths | .preinit_array : |
92 | 608e8ce2 | ths | { |
93 | 8733f609 | Gerd Hoffmann | PROVIDE (__preinit_array_start = .); |
94 | 608e8ce2 | ths | KEEP (*(.preinit_array)) |
95 | 8733f609 | Gerd Hoffmann | PROVIDE (__preinit_array_end = .); |
96 | 608e8ce2 | ths | } |
97 | 608e8ce2 | ths | .init_array : |
98 | 608e8ce2 | ths | { |
99 | 8733f609 | Gerd Hoffmann | PROVIDE (__init_array_start = .); |
100 | 608e8ce2 | ths | KEEP (*(SORT(.init_array.*))) |
101 | 608e8ce2 | ths | KEEP (*(.init_array)) |
102 | 8733f609 | Gerd Hoffmann | PROVIDE (__init_array_end = .); |
103 | 608e8ce2 | ths | } |
104 | 608e8ce2 | ths | .fini_array : |
105 | 608e8ce2 | ths | { |
106 | 8733f609 | Gerd Hoffmann | PROVIDE (__fini_array_start = .); |
107 | 608e8ce2 | ths | KEEP (*(.fini_array)) |
108 | 608e8ce2 | ths | KEEP (*(SORT(.fini_array.*))) |
109 | 8733f609 | Gerd Hoffmann | PROVIDE (__fini_array_end = .); |
110 | 608e8ce2 | ths | } |
111 | 608e8ce2 | ths | .ctors : |
112 | 608e8ce2 | ths | { |
113 | 608e8ce2 | ths | /* gcc uses crtbegin.o to find the start of |
114 | 608e8ce2 | ths | the constructors, so we make sure it is |
115 | 608e8ce2 | ths | first. Because this is a wildcard, it |
116 | 608e8ce2 | ths | doesn't matter if the user does not |
117 | 608e8ce2 | ths | actually link against crtbegin.o; the |
118 | 608e8ce2 | ths | linker won't look for a file to match a |
119 | 608e8ce2 | ths | wildcard. The wildcard also means that it |
120 | 608e8ce2 | ths | doesn't matter which directory crtbegin.o |
121 | 608e8ce2 | ths | is in. */ |
122 | 608e8ce2 | ths | KEEP (*crtbegin*.o(.ctors)) |
123 | 608e8ce2 | ths | /* We don't want to include the .ctor section from |
124 | 608e8ce2 | ths | the crtend.o file until after the sorted ctors. |
125 | 608e8ce2 | ths | The .ctor section from the crtend file contains the |
126 | 608e8ce2 | ths | end of ctors marker and it must be last */ |
127 | 608e8ce2 | ths | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) |
128 | 608e8ce2 | ths | KEEP (*(SORT(.ctors.*))) |
129 | 608e8ce2 | ths | KEEP (*(.ctors)) |
130 | 608e8ce2 | ths | } |
131 | 608e8ce2 | ths | .dtors : |
132 | 608e8ce2 | ths | { |
133 | 608e8ce2 | ths | KEEP (*crtbegin*.o(.dtors)) |
134 | 608e8ce2 | ths | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) |
135 | 608e8ce2 | ths | KEEP (*(SORT(.dtors.*))) |
136 | 608e8ce2 | ths | KEEP (*(.dtors)) |
137 | 608e8ce2 | ths | } |
138 | 608e8ce2 | ths | .jcr : { KEEP (*(.jcr)) } |
139 | 608e8ce2 | ths | .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } |
140 | 608e8ce2 | ths | . = DATA_SEGMENT_RELRO_END (0, .); |
141 | 608e8ce2 | ths | .data : |
142 | 608e8ce2 | ths | { |
143 | 608e8ce2 | ths | _fdata = . ; |
144 | 608e8ce2 | ths | *(.data .data.* .gnu.linkonce.d.*) |
145 | 608e8ce2 | ths | KEEP (*(.gnu.linkonce.d.*personality*)) |
146 | 608e8ce2 | ths | SORT(CONSTRUCTORS) |
147 | 608e8ce2 | ths | } |
148 | 608e8ce2 | ths | .data1 : { *(.data1) } |
149 | 608e8ce2 | ths | . = .; |
150 | 608e8ce2 | ths | _gp = ALIGN(16) + 0x7ff0; |
151 | 608e8ce2 | ths | .got : { *(.got.plt) *(.got) } |
152 | 608e8ce2 | ths | /* We want the small data sections together, so single-instruction offsets |
153 | 608e8ce2 | ths | can access them all, and initialized data all before uninitialized, so |
154 | 608e8ce2 | ths | we can shorten the on-disk segment size. */ |
155 | 608e8ce2 | ths | .sdata : |
156 | 608e8ce2 | ths | { |
157 | 608e8ce2 | ths | *(.sdata .sdata.* .gnu.linkonce.s.*) |
158 | 608e8ce2 | ths | } |
159 | 608e8ce2 | ths | .lit8 : { *(.lit8) } |
160 | 608e8ce2 | ths | .lit4 : { *(.lit4) } |
161 | 608e8ce2 | ths | _edata = .; PROVIDE (edata = .); |
162 | 608e8ce2 | ths | __bss_start = .; |
163 | 608e8ce2 | ths | _fbss = .; |
164 | 608e8ce2 | ths | .sbss : |
165 | 608e8ce2 | ths | { |
166 | 608e8ce2 | ths | *(.dynsbss) |
167 | 608e8ce2 | ths | *(.sbss .sbss.* .gnu.linkonce.sb.*) |
168 | 608e8ce2 | ths | *(.scommon) |
169 | 608e8ce2 | ths | } |
170 | 608e8ce2 | ths | .bss : |
171 | 608e8ce2 | ths | { |
172 | 608e8ce2 | ths | *(.dynbss) |
173 | 608e8ce2 | ths | *(.bss .bss.* .gnu.linkonce.b.*) |
174 | 608e8ce2 | ths | *(COMMON) |
175 | 608e8ce2 | ths | /* Align here to ensure that the .bss section occupies space up to |
176 | 608e8ce2 | ths | _end. Align after .bss to ensure correct alignment even if the |
177 | 608e8ce2 | ths | .bss section disappears because there are no input sections. |
178 | 608e8ce2 | ths | FIXME: Why do we need it? When there is no .bss section, we don't |
179 | 608e8ce2 | ths | pad the .data section. */ |
180 | 608e8ce2 | ths | . = ALIGN(. != 0 ? 32 / 8 : 1); |
181 | 608e8ce2 | ths | } |
182 | 608e8ce2 | ths | . = ALIGN(32 / 8); |
183 | 608e8ce2 | ths | . = ALIGN(32 / 8); |
184 | 608e8ce2 | ths | _end = .; PROVIDE (end = .); |
185 | 608e8ce2 | ths | . = DATA_SEGMENT_END (.); |
186 | 608e8ce2 | ths | /* Stabs debugging sections. */ |
187 | 608e8ce2 | ths | .stab 0 : { *(.stab) } |
188 | 608e8ce2 | ths | .stabstr 0 : { *(.stabstr) } |
189 | 608e8ce2 | ths | .stab.excl 0 : { *(.stab.excl) } |
190 | 608e8ce2 | ths | .stab.exclstr 0 : { *(.stab.exclstr) } |
191 | 608e8ce2 | ths | .stab.index 0 : { *(.stab.index) } |
192 | 608e8ce2 | ths | .stab.indexstr 0 : { *(.stab.indexstr) } |
193 | 608e8ce2 | ths | .comment 0 : { *(.comment) } |
194 | 608e8ce2 | ths | /* DWARF debug sections. |
195 | 608e8ce2 | ths | Symbols in the DWARF debugging sections are relative to the beginning |
196 | 608e8ce2 | ths | of the section so we begin them at 0. */ |
197 | 608e8ce2 | ths | /* DWARF 1 */ |
198 | 608e8ce2 | ths | .debug 0 : { *(.debug) } |
199 | 608e8ce2 | ths | .line 0 : { *(.line) } |
200 | 608e8ce2 | ths | /* GNU DWARF 1 extensions */ |
201 | 608e8ce2 | ths | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
202 | 608e8ce2 | ths | .debug_sfnames 0 : { *(.debug_sfnames) } |
203 | 608e8ce2 | ths | /* DWARF 1.1 and DWARF 2 */ |
204 | 608e8ce2 | ths | .debug_aranges 0 : { *(.debug_aranges) } |
205 | 608e8ce2 | ths | .debug_pubnames 0 : { *(.debug_pubnames) } |
206 | 608e8ce2 | ths | /* DWARF 2 */ |
207 | 608e8ce2 | ths | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
208 | 608e8ce2 | ths | .debug_abbrev 0 : { *(.debug_abbrev) } |
209 | 608e8ce2 | ths | .debug_line 0 : { *(.debug_line) } |
210 | 608e8ce2 | ths | .debug_frame 0 : { *(.debug_frame) } |
211 | 608e8ce2 | ths | .debug_str 0 : { *(.debug_str) } |
212 | 608e8ce2 | ths | .debug_loc 0 : { *(.debug_loc) } |
213 | 608e8ce2 | ths | .debug_macinfo 0 : { *(.debug_macinfo) } |
214 | 608e8ce2 | ths | /* SGI/MIPS DWARF 2 extensions */ |
215 | 608e8ce2 | ths | .debug_weaknames 0 : { *(.debug_weaknames) } |
216 | 608e8ce2 | ths | .debug_funcnames 0 : { *(.debug_funcnames) } |
217 | 608e8ce2 | ths | .debug_typenames 0 : { *(.debug_typenames) } |
218 | 608e8ce2 | ths | .debug_varnames 0 : { *(.debug_varnames) } |
219 | 608e8ce2 | ths | .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } |
220 | 608e8ce2 | ths | .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } |
221 | 608e8ce2 | ths | /DISCARD/ : { *(.note.GNU-stack) } |
222 | 608e8ce2 | ths | } |