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