xref: /netbsd-src/sys/arch/amd64/conf/kern.ldscript (revision aadbe7d326d39f99c1852996687893af35a18d95)
1/*	$NetBSD: kern.ldscript,v 1.31 2020/01/09 00:42:24 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	.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		. = ALIGN(COHERENCY_UNIT);
52		__CTOR_LIST__ = .;
53		*(.ctors)
54		__CTOR_END__ = .;
55	}
56
57	. = ALIGN(__LARGE_PAGE_SIZE);
58
59	__data_start = . ;
60	.data :
61	{
62		*(.data)
63	}
64
65	. = ALIGN(COHERENCY_UNIT);
66	.data.cacheline_aligned :
67	{
68		*(.data.cacheline_aligned)
69	}
70	. = ALIGN(COHERENCY_UNIT);
71	.data.read_mostly :
72	{
73		*(.data.read_mostly)
74	}
75	. = ALIGN(COHERENCY_UNIT);
76
77	_edata = . ;
78	PROVIDE (edata = .) ;
79	__bss_start = . ;
80	.bss :
81	{
82		*(.bss)
83		*(.bss.*)
84		*(COMMON)
85		. = ALIGN(__LARGE_PAGE_SIZE);
86	}
87
88	. = ALIGN(__PAGE_SIZE);
89
90	/* End of the kernel image */
91	__kernel_end = . ;
92
93	_end = . ;
94	PROVIDE (end = .) ;
95	.note.netbsd.ident :
96	{
97		KEEP(*(.note.netbsd.ident));
98	}
99}
100
101