xref: /DragonOS/kernel/src/arch/x86_64/link.lds (revision 081428c0d832cde99834cf8f94a0f2a1f41c9704)
1
2OUTPUT_FORMAT("elf64-x86-64","elf64-x86-64","elf64-x86-64")
3OUTPUT_ARCH(i386:x86-64)
4ENTRY(_start)
5
6SECTIONS
7{
8	KERNEL_VMA = 0xffff800000000000;
9	//KERNEL_VMA = 0;
10	. = 0;
11	. = 0x100000;
12	_default_kernel_load_base = .;
13	.boot.text :
14	{
15		KEEP(*(.multiboot_header))
16		KEEP(*(.multiboot2_header))
17
18		*(.bootstrap)
19		*(.bootstrap.code64)
20		*(.bootstrap.data)
21
22		. = ALIGN(4096);
23	}
24
25
26	. = ALIGN(32768);
27	. += KERNEL_VMA;
28	text_start_pa = .;
29	__executable_start = .;
30	.text (text_start_pa): AT(text_start_pa - KERNEL_VMA)
31	{
32		_text = .;
33
34		/* any files' .text */
35		*(.text)
36
37		/* any files' .text.*, for example: rust .text._ZN* */
38		*(.text.*)
39
40		_etext = .;
41		__etext = .;
42	}
43	. = ALIGN(32768);
44	data_start_pa = .;
45	.data (data_start_pa): AT(data_start_pa - KERNEL_VMA)
46	{
47		_data = .;
48		*(.data)
49		*(.data.*)
50
51		_edata = .;
52	}
53
54	. = ALIGN(32768);
55
56	rodata_start_pa = .;
57	.rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA)
58	{
59		_rodata = .;
60		*(.rodata)
61		*(.rodata.*)
62		*(.note.gnu.*)
63		*(.fixup)
64		_erodata = .;
65	}
66
67	. = ALIGN(32768);
68
69	init_proc_union_start_pa = .;
70	.data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA)
71	 { *(.data.init_proc_union) }
72
73	. = ALIGN(32768);
74	 bss_start_pa = .;
75	.bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA)
76	{
77		_bss = .;
78		*(.bss)
79		*(.bss.*)
80		_ebss = .;
81	}
82
83	eh_frame = .;
84	.eh_frame (eh_frame): AT(eh_frame - KERNEL_VMA)
85	{
86		__eh_frame_hdr_start = .;
87		*(.eh_frame_hdr)
88		__eh_frame_hdr_end = .;
89		__eh_frame_start = .;
90		*(.eh_frame)
91		*(.rela.eh_frame)
92		__eh_frame_end = .;
93	}
94
95	_end = .;
96
97	/DISCARD/ : {
98		/* *(.eh_frame) */
99
100	}
101}
102