xref: /DragonOS/kernel/src/arch/x86_64/link.lds (revision 1ea2daad8121b77ed704e6d7c3a09f478147441d)
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
13	.boot.text :
14	{
15		KEEP(*(.multiboot_header))
16		*(.bootstrap)
17		*(.bootstrap.code64)
18		*(.bootstrap.data)
19		. = ALIGN(4096);
20	}
21
22	. = 0x1000000;
23	. += KERNEL_VMA;
24	. = ALIGN(32768);
25	text_start_pa = .;
26	.text (text_start_pa): AT(text_start_pa - KERNEL_VMA)
27	{
28		_text = .;
29
30		/* any files' .text */
31		*(.text)
32
33		/* any files' .text.*, for example: rust .text._ZN* */
34		*(.text.*)
35
36		_etext = .;
37	}
38	. = ALIGN(32768);
39	data_start_pa = .;
40	.data (data_start_pa): AT(data_start_pa - KERNEL_VMA)
41	{
42		_data = .;
43		*(.data)
44		*(.data.*)
45
46		_edata = .;
47	}
48
49	. = ALIGN(32768);
50
51	rodata_start_pa = .;
52	.rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA)
53	{
54		_rodata = .;
55		*(.rodata)
56		*(.rodata.*)
57		_erodata = .;
58	}
59
60	. = ALIGN(32768);
61
62	init_proc_union_start_pa = .;
63	.data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA)
64	 { *(.data.init_proc_union) }
65
66	. = ALIGN(32768);
67	 bss_start_pa = .;
68	.bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA)
69	{
70		_bss = .;
71		*(.bss)
72		*(.bss.*)
73		_ebss = .;
74	}
75
76	eh_frame = .;
77	.eh_frame (eh_frame): AT(eh_frame - KERNEL_VMA)
78	{
79		__eh_frame_hdr_start = .;
80		*(.eh_frame_hdr)
81		__eh_frame_hdr_end = .;
82		__eh_frame_start = .;
83		*(.eh_frame)
84		*(.rela.eh_frame)
85		__eh_frame_end = .;
86	}
87
88	_end = .;
89
90	/DISCARD/ : {
91		/* *(.eh_frame) */
92
93	}
94}
95