]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ldscripts/ARCH-amd64/main_dyn.ld
update
[l4.git] / l4 / pkg / ldscripts / ARCH-amd64 / main_dyn.ld
1 /* Default linker script, for normal executables */
2 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
3               "elf64-x86-64")
4 OUTPUT_ARCH(i386:x86-64)
5 ENTRY(_start)
6 PHDRS
7 {
8   phdr PT_PHDR PHDRS;
9   interp PT_INTERP;
10   ro PT_LOAD FILEHDR PHDRS;
11   rw PT_LOAD;
12   dyn PT_DYNAMIC;
13   ehf PT_GNU_EH_FRAME;
14   L4_DEFINE_L4PHDRS
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: */
24   PROVIDE (__executable_start = 0x400000); . = 0x400000 + 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.ldata      : { *(.rel.ldata .rel.ldata.* .rel.gnu.linkonce.l.*) }
59   .rela.ldata     : { *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) }
60   .rel.lbss       : { *(.rel.lbss .rel.lbss.* .rel.gnu.linkonce.lb.*) }
61   .rela.lbss      : { *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) }
62   .rel.lrodata    : { *(.rel.lrodata .rel.lrodata.* .rel.gnu.linkonce.lr.*) }
63   .rela.lrodata   : { *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) }
64   .rel.plt        : { *(.rel.plt) }
65   .rela.plt       : { *(.rela.plt) }
66   .init           :
67   {
68     KEEP (*(.init))
69   } =0x90909090
70   .plt            : { *(.plt) }
71   .text           :
72   {
73     _stext = .;
74     _prog_img_start = _stext;
75     *(.text .stub .text.* .gnu.linkonce.t.*)
76     KEEP (*(.text.*personality*))
77     /* .gnu.warning sections are handled specially by elf32.em.  */
78     *(.gnu.warning)
79   } =0x90909090
80   .fini           :
81   {
82     KEEP (*(.fini))
83     /* LONG(0xc3)  * terminate .fini */
84   } = 0x90909090
85
86   PROVIDE (_etext = .);
87   PROVIDE (etext = .);
88   .rol4re_elf_aux : {
89     KEEP (*(.rol4re_elf_aux))
90   } : ro : l4re_aux
91   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } : ro
92   .rodata1        : { *(.rodata1) }
93   .eh_frame_hdr : { *(.eh_frame_hdr) } :ehf :ro
94
95   .eh_frame       : ONLY_IF_RO
96   {
97     PROVIDE(__eh_frame_start__ = .);
98     KEEP (*(.eh_frame))
99     KEEP (*(.eh_frame_terminator))
100   } :ro
101
102   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } :ro
103   /* Adjust the address for the data segment.  We want to adjust up to
104      the same address within the page on the next page up.  */
105   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
106   PROVIDE (_sdata = .);
107   /* Exception handling  */
108   .eh_frame       : ONLY_IF_RW
109   {
110     PROVIDE (__eh_frame_start__ = .);
111     KEEP (*(.eh_frame))
112     KEEP (*(.eh_frame_terminator))
113   } :rw
114   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } :rw
115   /* Thread Local Storage sections  */
116   .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) } :rw
117   .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
118   .preinit_array     :
119   {
120     PROVIDE_HIDDEN (__preinit_array_start = .);
121     KEEP (*(.preinit_array))
122     PROVIDE_HIDDEN (__preinit_array_end = .);
123   }
124   .init_array     :
125   {
126      PROVIDE_HIDDEN (__init_array_start = .);
127      KEEP (*(SORT(.init_array.*)))
128      KEEP (*(.init_array))
129      PROVIDE_HIDDEN (__init_array_end = .);
130   }
131   .fini_array     :
132   {
133     PROVIDE_HIDDEN (__fini_array_start = .);
134     KEEP (*(.fini_array))
135     KEEP (*(SORT(.fini_array.*)))
136     PROVIDE_HIDDEN (__fini_array_end = .);
137   }
138   .ctors          :
139   {
140 /*    KEEP (*(.mark_beg_l4dde_ctors))
141     KEEP (*(.l4dde_ctors))
142     KEEP (*(.mark_end_l4dde_ctors))
143
144     KEEP (*(.mark_beg_ctors)) */
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   }
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   .jcr            : { KEEP (*(.jcr)) }
203   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
204   .dynamic        : { *(.dynamic) } :dyn :rw
205   .got            : { *(.got) } :rw
206   . = DATA_SEGMENT_RELRO_END (24, .);
207   .got.plt        : { *(.got.plt) }
208   .data           :
209   {
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 ? 64 / 8 : 1);
228   }
229   .lbss   :
230   {
231     *(.dynlbss)
232     *(.lbss .lbss.* .gnu.linkonce.lb.*)
233     *(LARGE_COMMON)
234   }
235   . = ALIGN(64 / 8);
236   .lrodata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
237   {
238     *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
239   }
240   .ldata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
241   {
242     *(.ldata .ldata.* .gnu.linkonce.l.*)
243     . = ALIGN(. != 0 ? 64 / 8 : 1);
244   }
245   . = ALIGN(64 / 8);
246   _end = .; PROVIDE (end = .);
247   . = DATA_SEGMENT_END (.);
248   /* Stabs debugging sections.  */
249   .stab          0 : { *(.stab) }  :NONE
250   .stabstr       0 : { *(.stabstr) }
251   .stab.excl     0 : { *(.stab.excl) }
252   .stab.exclstr  0 : { *(.stab.exclstr) }
253   .stab.index    0 : { *(.stab.index) }
254   .stab.indexstr 0 : { *(.stab.indexstr) }
255   .comment       0 : { *(.comment) }
256   /* DWARF debug sections.
257      Symbols in the DWARF debugging sections are relative to the beginning
258      of the section so we begin them at 0.  */
259   /* DWARF 1 */
260   .debug          0 : { *(.debug) }
261   .line           0 : { *(.line) }
262   /* GNU DWARF 1 extensions */
263   .debug_srcinfo  0 : { *(.debug_srcinfo) }
264   .debug_sfnames  0 : { *(.debug_sfnames) }
265   /* DWARF 1.1 and DWARF 2 */
266   .debug_aranges  0 : { *(.debug_aranges) }
267   .debug_pubnames 0 : { *(.debug_pubnames) }
268   /* DWARF 2 */
269   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
270   .debug_abbrev   0 : { *(.debug_abbrev) }
271   .debug_line     0 : { *(.debug_line) }
272   .debug_frame    0 : { *(.debug_frame) }
273   .debug_str      0 : { *(.debug_str) }
274   .debug_loc      0 : { *(.debug_loc) }
275   .debug_macinfo  0 : { *(.debug_macinfo) }
276   /* SGI/MIPS DWARF 2 extensions */
277   .debug_weaknames 0 : { *(.debug_weaknames) }
278   .debug_funcnames 0 : { *(.debug_funcnames) }
279   .debug_typenames 0 : { *(.debug_typenames) }
280   .debug_varnames  0 : { *(.debug_varnames) }
281   /* DWARF 3 */
282   .debug_pubtypes 0 : { *(.debug_pubtypes) }
283   .debug_ranges   0 : { *(.debug_ranges) }
284   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
285   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
286 }