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