kern.ldscript revision 1.30
1/*	$NetBSD: kern.ldscript,v 1.30 2019/12/15 02:56:40 manu Exp $	*/
2
3#include "assym.h"
4
5/*
6 * PAE is enabled by default on amd64, the large page size is therefore
7 * 2MB (and not 4MB!).
8 */
9
10__PAGE_SIZE = 0x1000 ;
11__LARGE_PAGE_SIZE = 0x200000 ;
12
13ENTRY(_start)
14SECTIONS
15{
16	/*
17	 * multiboot (file_offset) : AT (load_address) 
18	 * file_offset must be below 32k for multiboot 2 specification
19	 * BIOS boot requires load_address above 0x200000
20	 */
21	multiboot 0x1000 : AT (0x200000)
22	{
23		. = ALIGN(8);
24		KEEP(*(multiboot));
25	}
26	.text : AT (0x200000 + SIZEOF(multiboot))
27	{
28		. = ALIGN(__PAGE_SIZE);
29		__text_user_start = . ;
30		*(.text.user)
31		. = ALIGN(__PAGE_SIZE);
32		__text_user_end = . ;
33
34		*(.text)
35		*(.text.*)
36		*(.stub)
37		. = ALIGN(__LARGE_PAGE_SIZE);
38	} =0xCC
39	_etext = . ;
40	PROVIDE (etext = .) ;
41
42	/*
43	 * Push the rodata segment up to the next large page boundary so that we
44	 * can map the text segment with large pages.
45	 */
46	. = ALIGN(__LARGE_PAGE_SIZE);
47
48	__rodata_start = . ;
49
50	.rodata.hotpatch :
51	{
52		__rodata_hotpatch_start = . ;
53		*(.rodata.hotpatch)
54		__rodata_hotpatch_end = . ;
55	}
56
57	.rodata :
58	{
59		*(.rodata)
60		*(.rodata.*)
61		. = ALIGN(COHERENCY_UNIT);
62		__CTOR_LIST__ = .;
63		*(.ctors)
64		__CTOR_END__ = .;
65	}
66
67	. = ALIGN(__LARGE_PAGE_SIZE);
68
69	__data_start = . ;
70	.data :
71	{
72		*(.data)
73	}
74
75	. = ALIGN(COHERENCY_UNIT);
76	.data.cacheline_aligned :
77	{
78		*(.data.cacheline_aligned)
79	}
80	. = ALIGN(COHERENCY_UNIT);
81	.data.read_mostly :
82	{
83		*(.data.read_mostly)
84	}
85	. = ALIGN(COHERENCY_UNIT);
86
87	_edata = . ;
88	PROVIDE (edata = .) ;
89	__bss_start = . ;
90	.bss :
91	{
92		*(.bss)
93		*(.bss.*)
94		*(COMMON)
95		. = ALIGN(__LARGE_PAGE_SIZE);
96	}
97
98	. = ALIGN(__PAGE_SIZE);
99
100	/* End of the kernel image */
101	__kernel_end = . ;
102
103	_end = . ;
104	PROVIDE (end = .) ;
105	.note.netbsd.ident :
106	{
107		KEEP(*(.note.netbsd.ident));
108	}
109}
110
111