]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ldscripts/ARCH-amd64/main_stat.ld
update
[l4.git] / l4 / pkg / ldscripts / ARCH-amd64 / 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   *(.stapsdt.*)
60   *(.note.stapsdt)
61   *(.plt) }
62   .text : ALIGN(0x1000)
63   {
64     _stext = .;
65     *(.text .text.* .gnu.linkonce.t.*)
66     *(.text .stub .text.* .gnu.linkonce.t.*)
67     KEEP (*(.text.*personality*))
68     /* .gnu.warning sections are handled specially by elf32.em.  */
69     *(.gnu.warning)
70   } :ro =0x90909090
71   .init           :
72   {
73     KEEP (*(.init))
74   } :ro =0x90909090
75   .fini           :
76   {
77     KEEP (*(.fini))
78   } :ro = 0x9090
79
80   PROVIDE (_etext = .);
81   PROVIDE (etext = .);
82   .rol4re_elf_aux : {
83     KEEP (*(.rol4re_elf_aux))
84   } : l4re_aux : ro
85   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } : ro
86   .rodata1        : { *(.rodata1) }
87   .eh_frame_hdr : { *(.eh_frame_hdr) } :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
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
140     /* gcc uses crtbegin.o to find the start of
141        the constructors, so we make sure it is
142        first.  Because this is a wildcard, it
143        doesn't matter if the user does not
144        actually link against crtbegin.o; the
145        linker won't look for a file to match a
146        wildcard.  The wildcard also means that it
147        doesn't matter which directory crtbegin.o
148        is in.  */
149     KEEP (*crtbegin.o(.ctors))
150     KEEP (*crtbegin?.o(.ctors))
151     /* We don't want to include the .ctor section from
152        the crtend.o file until after the sorted ctors.
153        The .ctor section from the crtend file contains the
154        end of ctors marker and it must be last */
155     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
156     KEEP (*(SORT(.ctors.*)))
157     KEEP (*(.ctors))
158     /*
159     KEEP (*(.mark_end_ctors))
160
161     KEEP (*(.mark_beg_c_ctors))
162     KEEP (*(SORT(.c_ctors.?)))
163     KEEP (*(SORT(.c_ctors.??)))
164     KEEP (*(SORT(.c_ctors.???)))
165     KEEP (*(SORT(.c_ctors.????)))
166     KEEP (*(SORT(.c_ctors.?????)))
167     KEEP (*(.c_ctors))
168     KEEP (*(.mark_end_c_ctors))
169     */
170   } :rw
171
172   .dtors :
173   {
174   /*
175     KEEP (*(.mark_beg_dtors))*/
176     KEEP (*crtbegin.o(.dtors))
177     KEEP (*crtbegin?.o(.dtors))
178     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
179     KEEP (*(SORT(.dtors.*)))
180     KEEP (*(.dtors))
181     /*
182     KEEP (*(.mark_end_dtors))
183
184     KEEP (*(.mark_beg_c_sys_dtors))
185     KEEP (*(SORT(.c_dtors.?)))
186     KEEP (*(SORT(.c_dtors.??)))
187     KEEP (*(.mark_end_c_sys_dtors))
188
189     KEEP (*(.mark_beg_c_dtors))
190     KEEP (*(SORT(.c_dtors.???)))
191     KEEP (*(SORT(.c_dtors.????)))
192     KEEP (*(SORT(.c_dtors.?????)))
193     KEEP (*(.c_dtors))
194     KEEP (*(.mark_end_c_dtors))*/
195   }
196   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
197   .dynamic        : { *(.dynamic) } :rw
198   .got            : { *(.got) } :rw
199   . = DATA_SEGMENT_RELRO_END (12, .);
200   .got.plt        : { *(.got.plt) }
201   .data           :
202   {
203     *(.data .data.* .gnu.linkonce.d.*)
204     KEEP (*(.gnu.linkonce.d.*personality*))
205     SORT(CONSTRUCTORS)
206   }
207   .data1          : { *(.data1) }
208   _edata = .; PROVIDE (edata = .);
209   __bss_start = .;
210   .bss            :
211   {
212    *(.dynbss)
213    *(.bss .bss.* .gnu.linkonce.b.*)
214    *(COMMON)
215    /* Align here to ensure that the .bss section occupies space up to
216       _end.  Align after .bss to ensure correct alignment even if the
217       .bss section disappears because there are no input sections.
218       FIXME: Why do we need it? When there is no .bss section, we don't
219       pad the .data section.  */
220    . = ALIGN(. != 0 ? 64 / 8 : 1);
221   }
222   . = ALIGN(64 / 8);
223   . = ALIGN(64 / 8);
224   _end = .; PROVIDE (end = .);
225   . = DATA_SEGMENT_END (.);
226   . = ALIGN(CONSTANT(MAXPAGESIZE));
227   /* Stabs debugging sections.  */
228   .stab          0 : { *(.stab) } :NONE
229   .stabstr       0 : { *(.stabstr) }
230   .stab.excl     0 : { *(.stab.excl) }
231   .stab.exclstr  0 : { *(.stab.exclstr) }
232   .stab.index    0 : { *(.stab.index) }
233   .stab.indexstr 0 : { *(.stab.indexstr) }
234   .comment       0 : { *(.comment) }
235   /* DWARF debug sections.
236      Symbols in the DWARF debugging sections are relative to the beginning
237      of the section so we begin them at 0.  */
238   /* DWARF 1 */
239   .debug          0 : { *(.debug) }
240   .line           0 : { *(.line) }
241   /* GNU DWARF 1 extensions */
242   .debug_srcinfo  0 : { *(.debug_srcinfo) }
243   .debug_sfnames  0 : { *(.debug_sfnames) }
244   /* DWARF 1.1 and DWARF 2 */
245   .debug_aranges  0 : { *(.debug_aranges) }
246   .debug_pubnames 0 : { *(.debug_pubnames) }
247   /* DWARF 2 */
248   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
249   .debug_abbrev   0 : { *(.debug_abbrev) }
250   .debug_line     0 : { *(.debug_line) }
251   .debug_frame    0 : { *(.debug_frame) }
252   .debug_str      0 : { *(.debug_str) }
253   .debug_loc      0 : { *(.debug_loc) }
254   .debug_macinfo  0 : { *(.debug_macinfo) }
255   /* SGI/MIPS DWARF 2 extensions */
256   .debug_weaknames 0 : { *(.debug_weaknames) }
257   .debug_funcnames 0 : { *(.debug_funcnames) }
258   .debug_typenames 0 : { *(.debug_typenames) }
259   .debug_varnames  0 : { *(.debug_varnames) }
260   /* DWARF 3 */
261   .debug_pubtypes 0 : { *(.debug_pubtypes) }
262   .debug_ranges   0 : { *(.debug_ranges) }
263   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
264   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.interp) }
265 }