xref: /illumos-kvm-cmd/i386.ld (revision 68396ea9)
1/* ld script to make i386 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3 */
4OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
5OUTPUT_ARCH(i386)
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.text      :
19    { *(.rel.text) *(.rel.gnu.linkonce.t*) }
20  .rela.text     :
21    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
22  .rel.data      :
23    { *(.rel.data) *(.rel.gnu.linkonce.d*) }
24  .rela.data     :
25    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
26  .rel.rodata    :
27    { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
28  .rela.rodata   :
29    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
30  .rel.got       : { *(.rel.got)		}
31  .rela.got      : { *(.rela.got)		}
32  .rel.ctors     : { *(.rel.ctors)	}
33  .rela.ctors    : { *(.rela.ctors)	}
34  .rel.dtors     : { *(.rel.dtors)	}
35  .rela.dtors    : { *(.rela.dtors)	}
36  .rel.init      : { *(.rel.init)	}
37  .rela.init     : { *(.rela.init)	}
38  .rel.fini      : { *(.rel.fini)	}
39  .rela.fini     : { *(.rela.fini)	}
40  .rel.bss       : { *(.rel.bss)		}
41  .rela.bss      : { *(.rela.bss)		}
42  .rel.plt      :
43  {
44    *(.rel.plt)
45    PROVIDE_HIDDEN (__rel_iplt_start = .);
46    *(.rel.iplt)
47    PROVIDE_HIDDEN (__rel_iplt_end = .);
48  }
49  .rela.plt       :
50  {
51    *(.rela.plt)
52    PROVIDE_HIDDEN (__rela_iplt_start = .);
53    *(.rela.iplt)
54    PROVIDE_HIDDEN (__rela_iplt_end = .);
55  }
56  .init          : { *(.init)	} =0x47ff041f
57  .text      :
58  {
59    *(.text)
60    /* .gnu.warning sections are handled specially by elf32.em.  */
61    *(.gnu.warning)
62    *(.gnu.linkonce.t*)
63  } =0x47ff041f
64  _etext = .;
65  PROVIDE (etext = .);
66  .fini      : { *(.fini)    } =0x47ff041f
67  . = ALIGN(32 / 8);
68  PROVIDE (__preinit_array_start = .);
69  .preinit_array     : { *(.preinit_array) }
70  PROVIDE (__preinit_array_end = .);
71  PROVIDE (__init_array_start = .);
72  .init_array     : { *(.init_array) }
73  PROVIDE (__init_array_end = .);
74  PROVIDE (__fini_array_start = .);
75  .fini_array     : { *(.fini_array) }
76  PROVIDE (__fini_array_end = .);
77  .rodata    : { *(.rodata) *(.gnu.linkonce.r*) }
78  .rodata1   : { *(.rodata1) }
79  .reginfo : { *(.reginfo) }
80  /* Adjust the address for the data segment.  We want to adjust up to
81     the same address within the page on the next page up.  */
82  . = ALIGN(0x100000) + (. & (0x100000 - 1));
83  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
84  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
85  .data    :
86  {
87    *(.data)
88    *(.gnu.linkonce.d*)
89    CONSTRUCTORS
90  }
91  .data1   : { *(.data1) }
92  .ctors         :
93  {
94    *(.ctors)
95  }
96  .dtors         :
97  {
98    *(.dtors)
99  }
100  .plt      : { *(.plt)	}
101  .got           : { *(.got.plt) *(.got) }
102  .dynamic       : { *(.dynamic) }
103  /* We want the small data sections together, so single-instruction offsets
104     can access them all, and initialized data all before uninitialized, so
105     we can shorten the on-disk segment size.  */
106  .sdata     : { *(.sdata) }
107  _edata  =  .;
108  PROVIDE (edata = .);
109  __bss_start = .;
110  .sbss      : { *(.sbss) *(.scommon) }
111  .bss       :
112  {
113   *(.dynbss)
114   *(.bss)
115   *(COMMON)
116  }
117  _end = . ;
118  PROVIDE (end = .);
119  /* Stabs debugging sections.  */
120  .stab 0 : { *(.stab) }
121  .stabstr 0 : { *(.stabstr) }
122  .stab.excl 0 : { *(.stab.excl) }
123  .stab.exclstr 0 : { *(.stab.exclstr) }
124  .stab.index 0 : { *(.stab.index) }
125  .stab.indexstr 0 : { *(.stab.indexstr) }
126  .comment 0 : { *(.comment) }
127  /* DWARF debug sections.
128     Symbols in the DWARF debugging sections are relative to the beginning
129     of the section so we begin them at 0.  */
130  /* DWARF 1 */
131  .debug          0 : { *(.debug) }
132  .line           0 : { *(.line) }
133  /* GNU DWARF 1 extensions */
134  .debug_srcinfo  0 : { *(.debug_srcinfo) }
135  .debug_sfnames  0 : { *(.debug_sfnames) }
136  /* DWARF 1.1 and DWARF 2 */
137  .debug_aranges  0 : { *(.debug_aranges) }
138  .debug_pubnames 0 : { *(.debug_pubnames) }
139  /* DWARF 2 */
140  .debug_info     0 : { *(.debug_info) }
141  .debug_abbrev   0 : { *(.debug_abbrev) }
142  .debug_line     0 : { *(.debug_line) }
143  .debug_frame    0 : { *(.debug_frame) }
144  .debug_str      0 : { *(.debug_str) }
145  .debug_loc      0 : { *(.debug_loc) }
146  .debug_macinfo  0 : { *(.debug_macinfo) }
147  /* SGI/MIPS DWARF 2 extensions */
148  .debug_weaknames 0 : { *(.debug_weaknames) }
149  .debug_funcnames 0 : { *(.debug_funcnames) }
150  .debug_typenames 0 : { *(.debug_typenames) }
151  .debug_varnames  0 : { *(.debug_varnames) }
152  /* These must appear regardless of  .  */
153}
154