1/* Script for -z combreloc: combine and sort reloc sections */
2OUTPUT_FORMAT("elf32-i386", "elf32-i386",
3	      "elf32-i386")
4OUTPUT_ARCH(i386)
5ENTRY(_start)
6SEARCH_DIR("/usr/i686-linux-gnu/lib32"); SEARCH_DIR("=/usr/local/lib32"); SEARCH_DIR("=/lib32"); SEARCH_DIR("=/usr/lib32"); SEARCH_DIR("=/usr/local/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib/i386-linux-gnu"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/lib");
7SECTIONS
8{
9  /* Read-only sections, merged into text segment: */
10  PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x08048000)); . = SEGMENT_START("text-segment", 0x08048000) + SIZEOF_HEADERS;
11  .interp         : { *(.interp) }
12  .note.gnu.build-id : { *(.note.gnu.build-id) }
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.dyn        :
21    {
22      *(.rel.init)
23      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
24      *(.rel.fini)
25      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
26      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
27      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
28      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
29      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
30      *(.rel.ctors)
31      *(.rel.dtors)
32      *(.rel.got)
33      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
34      *(.rel.ifunc)
35    }
36  .rel.plt        :
37    {
38      *(.rel.plt)
39      PROVIDE_HIDDEN (__rel_iplt_start = .);
40      *(.rel.iplt)
41      PROVIDE_HIDDEN (__rel_iplt_end = .);
42    }
43  .init           :
44  {
45    KEEP (*(.init))
46  } =0x90909090
47  .plt            : { *(.plt) *(.iplt) }
48  .text           :
49  {
50    *(.text.unlikely .text.*_unlikely)
51    *(.text.exit .text.exit.*)
52    *(.text.startup .text.startup.*)
53    *(.text.hot .text.hot.*)
54    *(.text .stub .text.* .gnu.linkonce.t.*)
55    /* .gnu.warning sections are handled specially by elf32.em.  */
56    *(.gnu.warning)
57  } =0x90909090
58  .fini           :
59  {
60    KEEP (*(.fini))
61  } =0x90909090
62  PROVIDE (__etext = .);
63  PROVIDE (_etext = .);
64  PROVIDE (etext = .);
65  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
66  .rodata1        : { *(.rodata1) }
67
68  /* setction information for finsh shell begin */
69  . = ALIGN(4);
70  FSymTab : {
71      __fsymtab_start = .;
72      KEEP(*(FSymTab))
73      __fsymtab_end = .;
74  }
75  . = ALIGN(4);
76  VSymTab : {
77      __vsymtab_start = .;
78      KEEP(*(VSymTab))
79      __vsymtab_end = .;
80  }
81  . = ALIGN(4);
82  rti_fn : {
83      __rt_init_start = .;
84      KEEP(*(SORT(.rti_fn*)))
85      __rt_init_end = .;
86  }
87  . = ALIGN(4);
88  /* setction information for finsh shell end */
89
90  .eh_frame_hdr : { *(.eh_frame_hdr) }
91  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
92  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table
93  .gcc_except_table.*) }
94  /* These sections are generated by the Sun/Oracle C++ compiler.  */
95  .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
96  .exception_ranges*) }
97  /* Adjust the address for the data segment.  We want to adjust up to
98     the same address within the page on the next page up.  */
99  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
100  /* Exception handling  */
101  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
102  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
103  .exception_ranges   : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
104  /* Thread Local Storage sections  */
105  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
106  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
107  .preinit_array     :
108  {
109    PROVIDE_HIDDEN (__preinit_array_start = .);
110    KEEP (*(.preinit_array))
111    PROVIDE_HIDDEN (__preinit_array_end = .);
112  }
113  .init_array     :
114  {
115    PROVIDE_HIDDEN (__init_array_start = .);
116    KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
117    KEEP (*(.init_array))
118    KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
119    PROVIDE_HIDDEN (__init_array_end = .);
120  }
121  .fini_array     :
122  {
123    PROVIDE_HIDDEN (__fini_array_start = .);
124    KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
125    KEEP (*(.fini_array))
126    KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
127    PROVIDE_HIDDEN (__fini_array_end = .);
128  }
129  .ctors          :
130  {
131    /* gcc uses crtbegin.o to find the start of
132       the constructors, so we make sure it is
133       first.  Because this is a wildcard, it
134       doesn't matter if the user does not
135       actually link against crtbegin.o; the
136       linker won't look for a file to match a
137       wildcard.  The wildcard also means that it
138       doesn't matter which directory crtbegin.o
139       is in.  */
140    KEEP (*crtbegin.o(.ctors))
141    KEEP (*crtbegin?.o(.ctors))
142    /* We don't want to include the .ctor section from
143       the crtend.o file until after the sorted ctors.
144       The .ctor section from the crtend file contains the
145       end of ctors marker and it must be last */
146    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
147    KEEP (*(SORT(.ctors.*)))
148    KEEP (*(.ctors))
149  }
150  .dtors          :
151  {
152    KEEP (*crtbegin.o(.dtors))
153    KEEP (*crtbegin?.o(.dtors))
154    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
155    KEEP (*(SORT(.dtors.*)))
156    KEEP (*(.dtors))
157  }
158  .jcr            : { KEEP (*(.jcr)) }
159  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
160  .dynamic        : { *(.dynamic) }
161  .got            : { *(.got) *(.igot) }
162  . = DATA_SEGMENT_RELRO_END (12, .);
163  .got.plt        : { *(.got.plt)  *(.igot.plt) }
164  .data           :
165  {
166    *(.data .data.* .gnu.linkonce.d.*)
167    SORT(CONSTRUCTORS)
168  }
169  .data1          : { *(.data1) }
170  _edata = .; PROVIDE (edata = .);
171  __bss_start = .;
172  .bss            :
173  {
174   *(.dynbss)
175   *(.bss .bss.* .gnu.linkonce.b.*)
176   *(COMMON)
177   /* Align here to ensure that the .bss section occupies space up to
178      _end.  Align after .bss to ensure correct alignment even if the
179      .bss section disappears because there are no input sections.
180      FIXME: Why do we need it? When there is no .bss section, we don't
181      pad the .data section.  */
182   . = ALIGN(. != 0 ? 32 / 8 : 1);
183  }
184  . = ALIGN(32 / 8);
185  . = ALIGN(32 / 8);
186  _end = .; PROVIDE (end = .);
187  . = DATA_SEGMENT_END (.);
188  /* Stabs debugging sections.  */
189  .stab          0 : { *(.stab) }
190  .stabstr       0 : { *(.stabstr) }
191  .stab.excl     0 : { *(.stab.excl) }
192  .stab.exclstr  0 : { *(.stab.exclstr) }
193  .stab.index    0 : { *(.stab.index) }
194  .stab.indexstr 0 : { *(.stab.indexstr) }
195  .comment       0 : { *(.comment) }
196  /* DWARF debug sections.
197     Symbols in the DWARF debugging sections are relative to the beginning
198     of the section so we begin them at 0.  */
199  /* DWARF 1 */
200  .debug          0 : { *(.debug) }
201  .line           0 : { *(.line) }
202  /* GNU DWARF 1 extensions */
203  .debug_srcinfo  0 : { *(.debug_srcinfo) }
204  .debug_sfnames  0 : { *(.debug_sfnames) }
205  /* DWARF 1.1 and DWARF 2 */
206  .debug_aranges  0 : { *(.debug_aranges) }
207  .debug_pubnames 0 : { *(.debug_pubnames) }
208  /* DWARF 2 */
209  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
210  .debug_abbrev   0 : { *(.debug_abbrev) }
211  .debug_line     0 : { *(.debug_line) }
212  .debug_frame    0 : { *(.debug_frame) }
213  .debug_str      0 : { *(.debug_str) }
214  .debug_loc      0 : { *(.debug_loc) }
215  .debug_macinfo  0 : { *(.debug_macinfo) }
216  /* SGI/MIPS DWARF 2 extensions */
217  .debug_weaknames 0 : { *(.debug_weaknames) }
218  .debug_funcnames 0 : { *(.debug_funcnames) }
219  .debug_typenames 0 : { *(.debug_typenames) }
220  .debug_varnames  0 : { *(.debug_varnames) }
221  /* DWARF 3 */
222  .debug_pubtypes 0 : { *(.debug_pubtypes) }
223  .debug_ranges   0 : { *(.debug_ranges) }
224  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
225  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
226}
227