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