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