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