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