]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ldscripts/ARCH-x86/main_stat.ld
update
[l4.git] / l4 / pkg / ldscripts / ARCH-x86 / main_stat.ld
1 /* -*- Makefile -*- */
2 ENTRY(_start)
3
4 PHDRS
5 {
6   phdr PT_PHDR PHDRS;
7   ro PT_LOAD FILEHDR PHDRS;
8   rw PT_LOAD;
9   tls PT_TLS;
10   L4_DEFINE_L4PHDRS
11 }
12
13
14 SECTIONS
15 {
16   L4_DEFINE_X86_KERNEL_ENTRY_SYMS
17   PROVIDE (__executable_start = 0x0100000);
18   . = __executable_start + SIZEOF_HEADERS;
19
20   /* No program code/data before _stext/_prog_img_start! */
21
22   /* Read-only sections, merged into text segment. The start address of
23    * the text segment is : */
24   /DISCARD/ :
25   { *(.note.gnu.build-id)
26   *(.hash)
27   *(.gnu.hash)
28   *(.dynsym)
29   *(.dynstr)
30   *(.gnu.version)
31   *(.gnu.version_d)
32   *(.gnu.version_r)
33   *(.rel.init)
34   *(.rela.init)
35   *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
36   *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
37   *(.rel.fini)
38   *(.rela.fini)
39   *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
40   *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
41   *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
42   *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*)
43   *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
44   *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
45   *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
46   *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
47   *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
48   *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
49   *(.rel.ctors)
50   *(.rela.ctors)
51   *(.rel.dtors)
52   *(.rela.dtors)
53   *(.rel.got)
54   *(.rela.got)
55   *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
56   *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
57   *(.rel.plt)
58   *(.rela.plt)
59   *(.plt) }
60   .text :
61   {
62     _stext = .;
63     _prog_img_start = _stext;
64     *(.text .stub .text.* .gnu.linkonce.t.*)
65     KEEP (*(.text.*personality*))
66     /* .gnu.warning sections are handled specially by elf32.em.  */
67     *(.gnu.warning)
68   } :ro =0x90909090
69   .init           :
70   {
71     KEEP (*(.init))
72   } :ro =0x90909090
73   .fini           :
74   {
75     KEEP (*(.fini))
76     /* LONG(0xc3)  * terminate .fini */
77   } :ro = 0x9090
78
79   PROVIDE (_etext = .);
80   PROVIDE (etext = .);
81   .rol4re_elf_aux : {
82     KEEP (*(.rol4re_elf_aux))
83   } : ro : l4re_aux
84   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } : ro
85   .rodata1        : { *(.rodata1) }
86   .eh_frame_hdr : { *(.eh_frame_hdr) } :ro
87
88   .eh_frame       : ONLY_IF_RO
89   {
90     PROVIDE(__eh_frame_start__ = .);
91     KEEP (*(.eh_frame))
92     KEEP (*(.eh_frame_terminator))
93   } :ro
94
95   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
96
97
98   . = ALIGN(CONSTANT(MAXPAGESIZE));
99   /* Adjust the address for the data segment.  We want to adjust up to
100      the same address within the page on the next page up.  */
101   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
102   PROVIDE (_sdata = .);
103   /* Exception handling  */
104   .eh_frame       : ONLY_IF_RW
105   {
106     PROVIDE (__eh_frame_start__ = .);
107     KEEP (*(.eh_frame))
108     KEEP (*(.eh_frame_terminator))
109   } :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 : tls
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   } : rw
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   /* ensure that data starts at a new L4 page */
135   /*. = ALIGN(0x1000);*/
136   .ctors :
137   {
138 /*
139     KEEP (*(.mark_beg_l4dde_ctors))
140     KEEP (*(.l4dde_ctors))
141     KEEP (*(.mark_end_l4dde_ctors))
142
143     KEEP (*(.mark_beg_ctors))
144 */
145
146     /* gcc uses crtbegin.o to find the start of
147        the constructors, so we make sure it is
148        first.  Because this is a wildcard, it
149        doesn't matter if the user does not
150        actually link against crtbegin.o; the
151        linker won't look for a file to match a
152        wildcard.  The wildcard also means that it
153        doesn't matter which directory crtbegin.o
154        is in.  */
155     KEEP (*crtbegin.o(.ctors))
156     KEEP (*crtbegin?.o(.ctors))
157     /* We don't want to include the .ctor section from
158        the crtend.o file until after the sorted ctors.
159        The .ctor section from the crtend file contains the
160        end of ctors marker and it must be last */
161     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
162     KEEP (*(SORT(.ctors.*)))
163     KEEP (*(.ctors))
164     /*
165     KEEP (*(.mark_end_ctors))
166
167     KEEP (*(.mark_beg_c_ctors))
168     KEEP (*(SORT(.c_ctors.?)))
169     KEEP (*(SORT(.c_ctors.??)))
170     KEEP (*(SORT(.c_ctors.???)))
171     KEEP (*(SORT(.c_ctors.????)))
172     KEEP (*(SORT(.c_ctors.?????)))
173     KEEP (*(.c_ctors))
174     KEEP (*(.mark_end_c_ctors))
175     */
176   } :rw
177
178   .dtors :
179   {
180   /*
181     KEEP (*(.mark_beg_dtors))*/
182     KEEP (*crtbegin.o(.dtors))
183     KEEP (*crtbegin?.o(.dtors))
184     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
185     KEEP (*(SORT(.dtors.*)))
186     KEEP (*(.dtors))
187     /*
188     KEEP (*(.mark_end_dtors))
189
190     KEEP (*(.mark_beg_c_sys_dtors))
191     KEEP (*(SORT(.c_dtors.?)))
192     KEEP (*(SORT(.c_dtors.??)))
193     KEEP (*(.mark_end_c_sys_dtors))
194
195     KEEP (*(.mark_beg_c_dtors))
196     KEEP (*(SORT(.c_dtors.???)))
197     KEEP (*(SORT(.c_dtors.????)))
198     KEEP (*(SORT(.c_dtors.?????)))
199     KEEP (*(.c_dtors))
200     KEEP (*(.mark_end_c_dtors))*/
201   }
202   .data           :
203   {
204     PROVIDE_HIDDEN(__l4sys_invoke_indirect = .);
205     LONG (0xeacff000) /*__l4sys_invoke_direct)*/
206     *(.data .data.* .gnu.linkonce.d.*)
207     KEEP (*(.gnu.linkonce.d.*personality*))
208     SORT(CONSTRUCTORS)
209   }
210   .data1          : { *(.data1) }
211   _edata = .; PROVIDE (edata = .);
212   __bss_start = .;
213   .bss            :
214   {
215    *(.dynbss)
216    *(.bss .bss.* .gnu.linkonce.b.*)
217    *(COMMON)
218    /* Align here to ensure that the .bss section occupies space up to
219       _end.  Align after .bss to ensure correct alignment even if the
220       .bss section disappears because there are no input sections.
221       FIXME: Why do we need it? When there is no .bss section, we don't
222       pad the .data section.  */
223    . = ALIGN(. != 0 ? 32 / 8 : 1);
224   }
225   . = ALIGN(32 / 8);
226   . = ALIGN(32 / 8);
227   _end = .; PROVIDE (end = .);
228   . = DATA_SEGMENT_END (.);
229   . = ALIGN(CONSTANT(MAXPAGESIZE));
230   /* Stabs debugging sections.  */
231   .stab          0 : { *(.stab) } :NONE
232   .stabstr       0 : { *(.stabstr) }
233   .stab.excl     0 : { *(.stab.excl) }
234   .stab.exclstr  0 : { *(.stab.exclstr) }
235   .stab.index    0 : { *(.stab.index) }
236   .stab.indexstr 0 : { *(.stab.indexstr) }
237   .comment       0 : { *(.comment) }
238   /* DWARF debug sections.
239      Symbols in the DWARF debugging sections are relative to the beginning
240      of the section so we begin them at 0.  */
241   /* DWARF 1 */
242   .debug          0 : { *(.debug) }
243   .line           0 : { *(.line) }
244   /* GNU DWARF 1 extensions */
245   .debug_srcinfo  0 : { *(.debug_srcinfo) }
246   .debug_sfnames  0 : { *(.debug_sfnames) }
247   /* DWARF 1.1 and DWARF 2 */
248   .debug_aranges  0 : { *(.debug_aranges) }
249   .debug_pubnames 0 : { *(.debug_pubnames) }
250   /* DWARF 2 */
251   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
252   .debug_abbrev   0 : { *(.debug_abbrev) }
253   .debug_line     0 : { *(.debug_line) }
254   .debug_frame    0 : { *(.debug_frame) }
255   .debug_str      0 : { *(.debug_str) }
256   .debug_loc      0 : { *(.debug_loc) }
257   .debug_macinfo  0 : { *(.debug_macinfo) }
258   /* SGI/MIPS DWARF 2 extensions */
259   .debug_weaknames 0 : { *(.debug_weaknames) }
260   .debug_funcnames 0 : { *(.debug_funcnames) }
261   .debug_typenames 0 : { *(.debug_typenames) }
262   .debug_varnames  0 : { *(.debug_varnames) }
263   /* DWARF 3 */
264   .debug_pubtypes 0 : { *(.debug_pubtypes) }
265   .debug_ranges   0 : { *(.debug_ranges) }
266   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
267   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.interp) }
268 }