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