1/* Script for -z combreloc: combine and sort reloc sections */
2OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips",
3	      "elf32-tradlittlemips")
4OUTPUT_ARCH(mips)
5ENTRY(__start)
6SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
7/* Do we need any of these for elf?
8   __DYNAMIC = 0;    */
9SECTIONS
10{
11  /* Read-only sections, merged into text segment: */
12  PROVIDE (__executable_start = 0x0400000); . = 0x0400000 + SIZEOF_HEADERS;
13  .interp         : { *(.interp) }
14  .reginfo        : { *(.reginfo) }
15  .dynamic        : { *(.dynamic) }
16  .hash           : { *(.hash) }
17  .dynsym         : { *(.dynsym) }
18  .dynstr         : { *(.dynstr) }
19  .gnu.version    : { *(.gnu.version) }
20  .gnu.version_d  : { *(.gnu.version_d) }
21  .gnu.version_r  : { *(.gnu.version_r) }
22  .rel.dyn        :
23    {
24      *(.rel.init)
25      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
26      *(.rel.fini)
27      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
28      *(.rel.data.rel.ro*)
29      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
30      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
31      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
32      *(.rel.ctors)
33      *(.rel.dtors)
34      *(.rel.got)
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    KEEP (*(.text.*personality*))
71    /* .gnu.warning sections are handled specially by elf.em.  */
72    *(.gnu.warning)
73    *(.mips16.fn.*) *(.mips16.call.*)
74  } =0
75  .fini           :
76  {
77    KEEP (*(.fini))
78  } =0
79  PROVIDE (__etext = .);
80  PROVIDE (_etext = .);
81  PROVIDE (etext = .);
82  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
83  .rodata1        : { *(.rodata1) }
84  .sdata2         : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
85  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
86  .eh_frame_hdr : { *(.eh_frame_hdr) }
87  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
88  .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
89  /* Adjust the address for the data segment.  We want to adjust up to
90     the same address within the page on the next page up.  */
91  . = 0x10000000;
92  /* Exception handling  */
93  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
94  .gcc_except_table   : ONLY_IF_RW { KEEP (*(.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  /* Ensure the __preinit_array_start label is properly aligned.  We
99     could instead move the label definition inside the section, but
100     the linker would then create the section even if it turns out to
101     be empty, which isn't pretty.  */
102  . = ALIGN(32 / 8);
103  PROVIDE (__preinit_array_start = .);
104  .preinit_array     : { KEEP (*(.preinit_array)) }
105  PROVIDE (__preinit_array_end = .);
106  PROVIDE (__init_array_start = .);
107  .init_array     : { KEEP (*(.init_array)) }
108  PROVIDE (__init_array_end = .);
109  PROVIDE (__fini_array_start = .);
110  .fini_array     : { KEEP (*(.fini_array)) }
111  PROVIDE (__fini_array_end = .);
112  .ctors          :
113  {
114    /* gcc uses crtbegin.o to find the start of
115       the constructors, so we make sure it is
116       first.  Because this is a wildcard, it
117       doesn't matter if the user does not
118       actually link against crtbegin.o; the
119       linker won't look for a file to match a
120       wildcard.  The wildcard also means that it
121       doesn't matter which directory crtbegin.o
122       is in.  */
123    KEEP (*crtbegin*.o(.ctors))
124    /* We don't want to include the .ctor section from
125       from the crtend.o file until after the sorted ctors.
126       The .ctor section from the crtend file contains the
127       end of ctors marker and it must be last */
128    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
129    KEEP (*(SORT(.ctors.*)))
130    KEEP (*(.ctors))
131  }
132  .dtors          :
133  {
134    KEEP (*crtbegin*.o(.dtors))
135    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
136    KEEP (*(SORT(.dtors.*)))
137    KEEP (*(.dtors))
138  }
139  .jcr            : { KEEP (*(.jcr)) }
140  .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
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  HIDDEN (_gp = ALIGN(16) + 0x7ff0);
150  .got            : { *(.got.plt) *(.got) }
151  /* We want the small data sections together, so single-instruction offsets
152     can access them all, and initialized data all before uninitialized, so
153     we can shorten the on-disk segment size.  */
154  .sdata          :
155  {
156    *(.sdata .sdata.* .gnu.linkonce.s.*)
157  }
158  .lit8           : { *(.lit8) }
159  .lit4           : { *(.lit4) }
160  _edata = .;
161  PROVIDE (edata = .);
162  __bss_start = .;
163  _fbss = .;
164  .sbss           :
165  {
166    PROVIDE (__sbss_start = .);
167    PROVIDE (___sbss_start = .);
168    *(.dynsbss)
169    *(.sbss .sbss.* .gnu.linkonce.sb.*)
170    *(.scommon)
171    PROVIDE (__sbss_end = .);
172    PROVIDE (___sbss_end = .);
173  }
174  .bss            :
175  {
176   *(.dynbss)
177   *(.bss .bss.* .gnu.linkonce.b.*)
178   *(COMMON)
179   /* Align here to ensure that the .bss section occupies space up to
180      _end.  Align after .bss to ensure correct alignment even if the
181      .bss section disappears because there are no input sections.  */
182   . = ALIGN(. != 0 ? 32 / 8 : 1);
183  }
184  . = ALIGN(32 / 8);
185  _end = .;
186  PROVIDE (end = .);
187  /* Stabs debugging sections.  */
188  .stab          0 : { *(.stab) }
189  .stabstr       0 : { *(.stabstr) }
190  .stab.excl     0 : { *(.stab.excl) }
191  .stab.exclstr  0 : { *(.stab.exclstr) }
192  .stab.index    0 : { *(.stab.index) }
193  .stab.indexstr 0 : { *(.stab.indexstr) }
194  .comment       0 : { *(.comment) }
195  /* DWARF debug sections.
196     Symbols in the DWARF debugging sections are relative to the beginning
197     of the section so we begin them at 0.  */
198  /* DWARF 1 */
199  .debug          0 : { *(.debug) }
200  .line           0 : { *(.line) }
201  /* GNU DWARF 1 extensions */
202  .debug_srcinfo  0 : { *(.debug_srcinfo) }
203  .debug_sfnames  0 : { *(.debug_sfnames) }
204  /* DWARF 1.1 and DWARF 2 */
205  .debug_aranges  0 : { *(.debug_aranges) }
206  .debug_pubnames 0 : { *(.debug_pubnames) }
207  /* DWARF 2 */
208  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
209  .debug_abbrev   0 : { *(.debug_abbrev) }
210  .debug_line     0 : { *(.debug_line) }
211  .debug_frame    0 : { *(.debug_frame) }
212  .debug_str      0 : { *(.debug_str) }
213  .debug_loc      0 : { *(.debug_loc) }
214  .debug_macinfo  0 : { *(.debug_macinfo) }
215  /* SGI/MIPS DWARF 2 extensions */
216  .debug_weaknames 0 : { *(.debug_weaknames) }
217  .debug_funcnames 0 : { *(.debug_funcnames) }
218  .debug_typenames 0 : { *(.debug_typenames) }
219  .debug_varnames  0 : { *(.debug_varnames) }
220  .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
221  .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
222  /DISCARD/ : { *(.note.GNU-stack) *(.MIPS.abiflags) }
223}
224