]> 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   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)) } : ro : l4re_aux
85   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } : ro
86   .rodata1        : { *(.rodata1) }
87   .eh_frame_hdr : { *(.eh_frame_hdr) } :ehf :ro
88
89   .eh_frame       : ONLY_IF_RO
90   {
91     PROVIDE(__eh_frame_start__ = .);
92     KEEP (*(.eh_frame))
93     KEEP (*(.eh_frame_terminator))
94   } :ro
95
96   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
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 /*    KEEP (*(.mark_beg_l4dde_ctors))
139     KEEP (*(.l4dde_ctors))
140     KEEP (*(.mark_end_l4dde_ctors))
141
142     KEEP (*(.mark_beg_ctors)) */
143
144     /* gcc uses crtbegin.o to find the start of
145        the constructors, so we make sure it is
146        first.  Because this is a wildcard, it
147        doesn't matter if the user does not
148        actually link against crtbegin.o; the
149        linker won't look for a file to match a
150        wildcard.  The wildcard also means that it
151        doesn't matter which directory crtbegin.o
152        is in.  */
153     KEEP (*crtbegin.o(.ctors))
154     KEEP (*crtbegin?.o(.ctors))
155     /* We don't want to include the .ctor section from
156        the crtend.o file until after the sorted ctors.
157        The .ctor section from the crtend file contains the
158        end of ctors marker and it must be last */
159     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
160     KEEP (*(SORT(.ctors.*)))
161     KEEP (*(.ctors))
162     /*
163     KEEP (*(.mark_end_ctors))
164
165     KEEP (*(.mark_beg_c_ctors))
166     KEEP (*(SORT(.c_ctors.?)))
167     KEEP (*(SORT(.c_ctors.??)))
168     KEEP (*(SORT(.c_ctors.???)))
169     KEEP (*(SORT(.c_ctors.????)))
170     KEEP (*(SORT(.c_ctors.?????)))
171     KEEP (*(.c_ctors))
172     KEEP (*(.mark_end_c_ctors))
173     */
174   }
175
176   .dtors :
177   {
178   /*
179     KEEP (*(.mark_beg_dtors))*/
180     KEEP (*crtbegin.o(.dtors))
181     KEEP (*crtbegin?.o(.dtors))
182     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
183     KEEP (*(SORT(.dtors.*)))
184     KEEP (*(.dtors))
185     /*
186     KEEP (*(.mark_end_dtors))
187
188     KEEP (*(.mark_beg_c_sys_dtors))
189     KEEP (*(SORT(.c_dtors.?)))
190     KEEP (*(SORT(.c_dtors.??)))
191     KEEP (*(.mark_end_c_sys_dtors))
192
193     KEEP (*(.mark_beg_c_dtors))
194     KEEP (*(SORT(.c_dtors.???)))
195     KEEP (*(SORT(.c_dtors.????)))
196     KEEP (*(SORT(.c_dtors.?????)))
197     KEEP (*(.c_dtors))
198     KEEP (*(.mark_end_c_dtors))*/
199   }
200   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
201   .dynamic        : { *(.dynamic) } :dyn :rw
202   .got            : { *(.got) } :rw
203   . = DATA_SEGMENT_RELRO_END (12, .);
204   .got.plt        : { *(.got.plt) }
205   .data           :
206   {
207     PROVIDE_HIDDEN(__l4sys_invoke_indirect = .);
208     LONG (0xeacff000) /*__l4sys_invoke_direct)*/
209     *(.data .data.* .gnu.linkonce.d.*)
210     KEEP (*(.gnu.linkonce.d.*personality*))
211     SORT(CONSTRUCTORS)
212   }
213   .data1          : { *(.data1) }
214   _edata = .; PROVIDE (edata = .);
215   __bss_start = .;
216   .bss            :
217   {
218    *(.dynbss)
219    *(.bss .bss.* .gnu.linkonce.b.*)
220    *(COMMON)
221    /* Align here to ensure that the .bss section occupies space up to
222       _end.  Align after .bss to ensure correct alignment even if the
223       .bss section disappears because there are no input sections.
224       FIXME: Why do we need it? When there is no .bss section, we don't
225       pad the .data section.  */
226    . = ALIGN(. != 0 ? 32 / 8 : 1);
227   }
228   . = ALIGN(32 / 8);
229   . = ALIGN(32 / 8);
230   _end = .; PROVIDE (end = .);
231   . = DATA_SEGMENT_END (.);
232   . = ALIGN(CONSTANT(MAXPAGESIZE));
233   /* Stabs debugging sections.  */
234   .stab          0 : { *(.stab) } :NONE
235   .stabstr       0 : { *(.stabstr) }
236   .stab.excl     0 : { *(.stab.excl) }
237   .stab.exclstr  0 : { *(.stab.exclstr) }
238   .stab.index    0 : { *(.stab.index) }
239   .stab.indexstr 0 : { *(.stab.indexstr) }
240   .comment       0 : { *(.comment) }
241   /* DWARF debug sections.
242      Symbols in the DWARF debugging sections are relative to the beginning
243      of the section so we begin them at 0.  */
244   /* DWARF 1 */
245   .debug          0 : { *(.debug) }
246   .line           0 : { *(.line) }
247   /* GNU DWARF 1 extensions */
248   .debug_srcinfo  0 : { *(.debug_srcinfo) }
249   .debug_sfnames  0 : { *(.debug_sfnames) }
250   /* DWARF 1.1 and DWARF 2 */
251   .debug_aranges  0 : { *(.debug_aranges) }
252   .debug_pubnames 0 : { *(.debug_pubnames) }
253   /* DWARF 2 */
254   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
255   .debug_abbrev   0 : { *(.debug_abbrev) }
256   .debug_line     0 : { *(.debug_line) }
257   .debug_frame    0 : { *(.debug_frame) }
258   .debug_str      0 : { *(.debug_str) }
259   .debug_loc      0 : { *(.debug_loc) }
260   .debug_macinfo  0 : { *(.debug_macinfo) }
261   /* SGI/MIPS DWARF 2 extensions */
262   .debug_weaknames 0 : { *(.debug_weaknames) }
263   .debug_funcnames 0 : { *(.debug_funcnames) }
264   .debug_typenames 0 : { *(.debug_typenames) }
265   .debug_varnames  0 : { *(.debug_varnames) }
266   /* DWARF 3 */
267   .debug_pubtypes 0 : { *(.debug_pubtypes) }
268   .debug_ranges   0 : { *(.debug_ranges) }
269   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
270   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
271 }