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