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