kern.ldscript revision 1.25
1/*	$NetBSD: kern.ldscript,v 1.25 2018/01/07 12:42:46 maxv 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	.text : AT (ADDR(.text) & 0x0fffffff)
17	{
18		*(.text)
19		*(.text.*)
20		*(.stub)
21		. = ALIGN(__LARGE_PAGE_SIZE);
22	} =0xCC
23	_etext = . ;
24	PROVIDE (etext = .) ;
25
26	/*
27	 * Push the rodata segment up to the next large page boundary so that we
28	 * can map the text segment with large pages.
29	 */
30	. = ALIGN(__LARGE_PAGE_SIZE);
31
32	__rodata_start = . ;
33
34	.rodata.hotpatch :
35	{
36		__rodata_hotpatch_start = . ;
37		*(.rodata.hotpatch)
38		__rodata_hotpatch_end = . ;
39	}
40
41	.rodata :
42	{
43		*(.rodata)
44		*(.rodata.*)
45	}
46
47	. = ALIGN(__LARGE_PAGE_SIZE);
48
49	__data_start = . ;
50	.data :
51	{
52		*(.data)
53	}
54
55	. = ALIGN(COHERENCY_UNIT);
56	.data.cacheline_aligned :
57	{
58		*(.data.cacheline_aligned)
59	}
60	. = ALIGN(COHERENCY_UNIT);
61	.data.read_mostly :
62	{
63		*(.data.read_mostly)
64	}
65	. = ALIGN(COHERENCY_UNIT);
66
67	_edata = . ;
68	PROVIDE (edata = .) ;
69	__bss_start = . ;
70	.bss :
71	{
72		*(.bss)
73		*(.bss.*)
74		*(COMMON)
75		. = ALIGN(__LARGE_PAGE_SIZE);
76	}
77
78	. = ALIGN(__PAGE_SIZE);
79
80	/* End of the kernel image */
81	__kernel_end = . ;
82
83	_end = . ;
84	PROVIDE (end = .) ;
85	.note.netbsd.ident :
86	{
87		KEEP(*(.note.netbsd.ident));
88	}
89}
90
91