blob: 4176b7ecd2d56af545c5cb4d761d2b5b763d5385 [file] [log] [blame]
Andrew Hsieh38586de2014-01-27 22:20:28 -08001/* Script for ld --shared: link shared library */
2OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradbigmips",
3 "elf64-tradlittlemips")
4OUTPUT_ARCH(mips)
5ENTRY(__start)
6SECTIONS
7{
8 /* Read-only sections, merged into text segment: */
9 . = 0 + SIZEOF_HEADERS;
10 .MIPS.options : { *(.MIPS.options) }
11 .note.gnu.build-id : { *(.note.gnu.build-id) }
12 .dynamic : { *(.dynamic) }
13 .hash : { *(.hash) }
14 .gnu.hash : { *(.gnu.hash) }
15 .dynsym : { *(.dynsym) }
16 .dynstr : { *(.dynstr) }
17 .gnu.version : { *(.gnu.version) }
18 .gnu.version_d : { *(.gnu.version_d) }
19 .gnu.version_r : { *(.gnu.version_r) }
20 .rel.init : { *(.rel.init) }
21 .rela.init : { *(.rela.init) }
22 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
23 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
24 .rel.fini : { *(.rel.fini) }
25 .rela.fini : { *(.rela.fini) }
26 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
27 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
28 .rel.data.rel.ro : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) }
29 .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
30 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
31 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
32 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
33 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
34 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
35 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
36 .rel.ctors : { *(.rel.ctors) }
37 .rela.ctors : { *(.rela.ctors) }
38 .rel.dtors : { *(.rel.dtors) }
39 .rela.dtors : { *(.rela.dtors) }
40 .rel.got : { *(.rel.got) }
41 .rela.got : { *(.rela.got) }
42 .rel.dyn : { *(.rel.dyn) }
43 .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
44 .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
45 .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
46 .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
47 .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
48 .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
49 .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
50 .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
51 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
52 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
53 .rel.iplt :
54 {
55 *(.rel.iplt)
56 }
57 .rela.iplt :
58 {
59 *(.rela.iplt)
60 }
61 .rel.plt :
62 {
63 *(.rel.plt)
64 }
65 .rela.plt :
66 {
67 *(.rela.plt)
68 }
69 .init :
70 {
71 KEEP (*(SORT_NONE(.init)))
72 }
73 .plt : { *(.plt) }
74 .iplt : { *(.iplt) }
75 .text :
76 {
77 _ftext = . ;
78 *(.text.unlikely .text.*_unlikely)
79 *(.text.exit .text.exit.*)
80 *(.text.startup .text.startup.*)
81 *(.text.hot .text.hot.*)
82 *(.text .stub .text.* .gnu.linkonce.t.*)
83 /* .gnu.warning sections are handled specially by elf32.em. */
84 *(.gnu.warning)
85 *(.mips16.fn.*) *(.mips16.call.*)
86 }
87 .fini :
88 {
89 KEEP (*(SORT_NONE(.fini)))
90 }
91 PROVIDE (__etext = .);
92 PROVIDE (_etext = .);
93 PROVIDE (etext = .);
94 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
95 .rodata1 : { *(.rodata1) }
96 .eh_frame_hdr : { *(.eh_frame_hdr) }
97 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
98 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
99 .gcc_except_table.*) }
100 /* These sections are generated by the Sun/Oracle C++ compiler. */
101 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
102 .exception_ranges*) }
103 /* Adjust the address for the data segment. We want to align at exactly
104 a page boundary to make life easier for apriori. */
105 . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
106 /* Exception handling */
107 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
108 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
109 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
110 /* Thread Local Storage sections */
111 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
112 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
113 /* Ensure the __preinit_array_start label is properly aligned. We
114 could instead move the label definition inside the section, but
115 the linker would then create the section even if it turns out to
116 be empty, which isn't pretty. */
117 . = ALIGN(32 / 8);
118 .preinit_array :
119 {
120 KEEP (*(.preinit_array))
121 }
122 .init_array :
123 {
124 KEEP (*crtbegin*.o(.init_array))
125 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
126 KEEP (*(.init_array))
127 KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
128 }
129 .fini_array :
130 {
131 KEEP (*crtbegin*.o(.fini_array))
132 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
133 KEEP (*(.fini_array))
134 KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
135 }
136 .ctors :
137 {
138 /* gcc uses crtbegin.o to find the start of
139 the constructors, so we make sure it is
140 first. Because this is a wildcard, it
141 doesn't matter if the user does not
142 actually link against crtbegin.o; the
143 linker won't look for a file to match a
144 wildcard. The wildcard also means that it
145 doesn't matter which directory crtbegin.o
146 is in. */
147 KEEP (*crtbegin.o(.ctors))
148 KEEP (*crtbegin*.o(.ctors))
149 /* We don't want to include the .ctor section from
150 the crtend.o file until after the sorted ctors.
151 The .ctor section from the crtend file contains the
152 end of ctors marker and it must be last */
153 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors))
154 KEEP (*(SORT(.ctors.*)))
155 KEEP (*(.ctors))
156 }
157 .dtors :
158 {
159 KEEP (*crtbegin.o(.dtors))
160 KEEP (*crtbegin*.o(.dtors))
161 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors))
162 KEEP (*(SORT(.dtors.*)))
163 KEEP (*(.dtors))
164 }
165 .jcr : { KEEP (*(.jcr)) }
166 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
167 . = DATA_SEGMENT_RELRO_END (0, .);
168 .data :
169 {
170 _fdata = . ;
171 *(.data .data.* .gnu.linkonce.d.*)
172 SORT(CONSTRUCTORS)
173 }
174 .data1 : { *(.data1) }
175 .got.plt : { *(.got.plt) }
176 . = .;
177 . = .;
178 HIDDEN (_gp = ALIGN (16) + 0x7ff0);
179 .got : { *(.got) }
180 /* We want the small data sections together, so single-instruction offsets
181 can access them all, and initialized data all before uninitialized, so
182 we can shorten the on-disk segment size. */
183 .sdata :
184 {
185 *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
186 *(.sdata .sdata.* .gnu.linkonce.s.*)
187 }
188 .lit8 : { *(.lit8) }
189 .lit4 : { *(.lit4) }
190 .srdata : { *(.srdata) }
191 _edata = .; PROVIDE (edata = .);
192 . = .;
193 __bss_start = .;
194 _fbss = .;
195 .sbss :
196 {
197 *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
198 *(.dynsbss)
199 *(.sbss .sbss.* .gnu.linkonce.sb.*)
200 *(.scommon)
201 }
202 .bss :
203 {
204 *(.dynbss)
205 *(.bss .bss.* .gnu.linkonce.b.*)
206 *(COMMON)
207 /* Align here to ensure that the .bss section occupies space up to
208 _end. Align after .bss to ensure correct alignment even if the
209 .bss section disappears because there are no input sections. */
210 . = ALIGN(64 / 8);
211 }
212 . = ALIGN(64 / 8);
213 . = ALIGN(64 / 8);
214 _end = .;
215 _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
216 PROVIDE (end = .);
217 . = DATA_SEGMENT_END (.);
218 /* Stabs debugging sections. */
219 .stab 0 : { *(.stab) }
220 .stabstr 0 : { *(.stabstr) }
221 .stab.excl 0 : { *(.stab.excl) }
222 .stab.exclstr 0 : { *(.stab.exclstr) }
223 .stab.index 0 : { *(.stab.index) }
224 .stab.indexstr 0 : { *(.stab.indexstr) }
225 .comment 0 : { *(.comment) }
226 /* DWARF debug sections.
227 Symbols in the DWARF debugging sections are relative to the beginning
228 of the section so we begin them at 0. */
229 /* DWARF 1 */
230 .debug 0 : { *(.debug) }
231 .line 0 : { *(.line) }
232 /* GNU DWARF 1 extensions */
233 .debug_srcinfo 0 : { *(.debug_srcinfo) }
234 .debug_sfnames 0 : { *(.debug_sfnames) }
235 /* DWARF 1.1 and DWARF 2 */
236 .debug_aranges 0 : { *(.debug_aranges) }
237 .debug_pubnames 0 : { *(.debug_pubnames) }
238 /* DWARF 2 */
239 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
240 .debug_abbrev 0 : { *(.debug_abbrev) }
241 .debug_line 0 : { *(.debug_line) }
242 .debug_frame 0 : { *(.debug_frame) }
243 .debug_str 0 : { *(.debug_str) }
244 .debug_loc 0 : { *(.debug_loc) }
245 .debug_macinfo 0 : { *(.debug_macinfo) }
246 /* SGI/MIPS DWARF 2 extensions */
247 .debug_weaknames 0 : { *(.debug_weaknames) }
248 .debug_funcnames 0 : { *(.debug_funcnames) }
249 .debug_typenames 0 : { *(.debug_typenames) }
250 .debug_varnames 0 : { *(.debug_varnames) }
251 /* DWARF 3 */
252 .debug_pubtypes 0 : { *(.debug_pubtypes) }
253 .debug_ranges 0 : { *(.debug_ranges) }
254 /* DWARF Extension. */
255 .debug_macro 0 : { *(.debug_macro) }
256 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
257 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
258 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
259 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) }
260}