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