summaryrefslogtreecommitdiff
path: root/sys/arch/arm64/conf/kern.ldscript
blob: 9ec616f878a17c0f120193b19ee7169d0ba5d806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*     $OpenBSD: kern.ldscript,v 1.8 2018/02/11 21:07:08 patrick Exp $         */
/*     $NetBSD: ldscript.evbarm,v 1.2 2003/03/05 23:54:22 thorpej Exp $        */

OUTPUT_ARCH(aarch64)

/* Define how we want our ELF binary to look like. */
PHDRS
{
	text PT_LOAD;
	rodata PT_LOAD FLAGS (4);
	data PT_LOAD;
	openbsd_randomize PT_OPENBSD_RANDOMIZE;
}

__ALIGN_SIZE = 0x200000;
__kernel_base = @KERNEL_BASE_VIRT@;

ENTRY(_start)
SECTIONS
{
	. = __kernel_base;
	PROVIDE (__text_start = .);
	.text :
	{
		*(.text .text.*)
		*(.stub)
		*(.glue_7t) *(.glue_7)
	} :text =0
	PROVIDE (_etext = .);
	PROVIDE (etext = .);

	/* Move rodata to the next page, so we can nuke X and W bit on it */
	. = ALIGN(__ALIGN_SIZE);
	PROVIDE (__rodata_start = .);
	.rodata :
	{
		*(.rodata .rodata.*)
	} :rodata
	.openbsd.randomdata :
	{
		*(.openbsd.randomdata)
	} :openbsd_randomize :rodata
	PROVIDE (_erodata = .);

	/* Move .data to the next page, so we can add W bit on it */
	. = ALIGN(__ALIGN_SIZE);
	PROVIDE (__data_start = .);
	.got :
	{
		*(.got .got.*)
	} :data
	.data :
	{
		*(.data .data.*)
	} :data
	.sdata :
	{
		*(.sdata .sdata.*)
	} :data
	PROVIDE (_edata = .);

	PROVIDE (__bss_start = .);
	.sbss :
	{
		*(.dynsbss)
		*(.sbss)
		*(.sbss.*)
		*(.scommon)
	} :data
	.bss :
	{
		*(.dynbss)
		*(.bss)
		*(.bss.*)
		*(COMMON)
		/* Align here to ensure that the .bss section occupies space up to
		   _end.  Align after .bss to ensure correct alignment even if the
		   .bss section disappears because there are no input sections.  */
		. = ALIGN(64 / 8);
	} :data
	PROVIDE (_end = .);
	PROVIDE (end = .);
}