Statistics
| Branch: | Revision:

root / ppc.ld @ a74cdab4

History | View | Annotate | Download (8.5 kB)

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