xref: /haiku/src/system/ldscripts/x86_64/kernel.ld (revision fc7456e9b1ec38c941134ed6d01c438cf289381e)
1OUTPUT_FORMAT("elf64-x86-64")
2OUTPUT_ARCH("i386:x86-64")
3
4ENTRY(_start)
5SECTIONS
6{
7	. = 0xFFFFFFFF80000000 + SIZEOF_HEADERS;
8
9	.interp : { *(.interp) }
10	.hash : { *(.hash) }
11	.dynsym : { *(.dynsym) }
12	.dynstr : { *(.dynstr) }
13	.gnu.version : { *(.gnu.version) }
14	.gnu.version_d : { *(.gnu.version_d) }
15	.gnu.version_r : { *(.gnu.version_r) }
16	.init : { *(.init) } =0x90909090
17
18	/* text/read-only data */
19	.text :	{ *(.text .text.* .gnu.linkonce.t.*) } =0x90909090
20
21	.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
22
23	. = ALIGN(0x8);
24	altcodepatch_begin = .;
25	.altcodepatch : { *(.altcodepatch) }
26	altcodepatch_end = .;
27
28	.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
29
30	/* writable data */
31	. = ALIGN (0x1000);
32	__data_start = .;
33	.data : { *(.data .data.* .gnu.linkonce.d.*) }
34
35	_haiku_revision : { *(_haiku_revision) }
36
37	. = ALIGN(0x4);
38	__ctor_list = .;
39	.ctors : { *(.ctors) }
40	__ctor_end = .;
41	__dtor_list = .;
42	.dtors : { *(.dtors) }
43	__dtor_end = .;
44	.dynamic : { *(.dynamic) }
45
46	/* uninitialized data (in same segment as writable data) */
47	.bss : {
48		__bss_start = .;
49		*(.dynbss)
50		*(.bss .bss.* .gnu.linkonce.b.*)
51	}
52	. = ALIGN(0x1000);
53	_end = . ;
54
55	/* Debug  */
56	INCLUDE debuginfo.ld
57
58	/* Strip unnecessary stuff */
59	/DISCARD/ : { *(.comment .note .eh_frame .sframe) }
60
61	.got : { *(.got) *(.got.plt) *(.igot.*) }
62	ASSERT(SIZEOF(.got) == 0, "Unexpected .got found!")
63
64	.plt : { *(.plt) *(.plt.*) *(.iplt) }
65	ASSERT(SIZEOF(.plt) == 0, "Unexpected .plt found!")
66
67	.rela : { *(.rela.*) }
68	ASSERT(SIZEOF(.rela) == 0, "Unexpected .rela found!")
69}
70