1/*	$OpenBSD: kern.ldscript,v 1.5 2019/11/09 20:07:00 guenther Exp $	*/
2/*	$NetBSD: ldscript.evbarm,v 1.2 2003/03/05 23:54:22 thorpej Exp $	*/
3
4OUTPUT_ARCH(arm)
5
6/* Define how we want our ELF binary to look like. */
7PHDRS
8{
9	text PT_LOAD;
10	rodata PT_LOAD FLAGS (4);
11	data PT_LOAD;
12	openbsd_randomize PT_OPENBSD_RANDOMIZE;
13}
14
15__ALIGN_SIZE = 0x1000;
16__kernel_base = @KERNEL_BASE_VIRT@;
17
18ENTRY(bootstrap_start)
19SECTIONS
20{
21	. = __kernel_base;
22	PROVIDE (__text_start = .);
23	.text :
24	{
25		*(.text .text.*)
26		*(.stub)
27		*(.glue_7t) *(.glue_7)
28	} :text =0
29	PROVIDE (_etext = .);
30	PROVIDE (etext = .);
31
32	/* Move rodata to the next page, so we can nuke X and W bit on it */
33	. = ALIGN(__ALIGN_SIZE);
34	PROVIDE (__rodata_start = .);
35	.rodata :
36	{
37		*(.rodata .rodata.*)
38	} :rodata
39	.openbsd.randomdata :
40	{
41		__retguard_start = ABSOLUTE(.);
42		*(.openbsd.randomdata.retguard .openbsd.randomdata.retguard.*)
43		/* XXX . = ALIGN(__ALIGN_SIZE); */
44		__retguard_end = ABSOLUTE(.);
45		*(.openbsd.randomdata .openbsd.randomdata.*)
46	} :openbsd_randomize :rodata
47	PROVIDE (_erodata = .);
48
49	/* Move .data to the next page, so we can add W bit on it */
50	. = ALIGN(__ALIGN_SIZE);
51	PROVIDE (__data_start = .);
52	.data :
53	{
54		*(.data .data.*)
55	} :data
56	.sdata :
57	{
58		*(.sdata .sdata.*)
59	} :data
60	PROVIDE (_edata = .);
61
62	PROVIDE (__bss_start = .);
63	.sbss :
64	{
65		*(.dynsbss)
66		*(.sbss)
67		*(.sbss.*)
68		*(.scommon)
69	} :data
70	.bss :
71	{
72		*(.dynbss)
73		*(.bss)
74		*(.bss.*)
75		*(COMMON)
76		/* Align here to ensure that the .bss section occupies space up to
77		   _end.  Align after .bss to ensure correct alignment even if the
78		   .bss section disappears because there are no input sections.  */
79		. = ALIGN(32 / 8);
80	} :data
81	. = ALIGN(32 / 8);
82	PROVIDE (_end = .);
83	PROVIDE (end = .);
84	/DISCARD/ :
85	{
86		*(.ARM.exidx)
87	}
88}
89
90