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