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