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