xref: /openbmc/linux/arch/arm64/kernel/vmlinux.lds.S (revision cd5d5810)
1/*
2 * ld script to make ARM Linux kernel
3 * taken from the i386 version by Russell King
4 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
5 */
6
7#include <asm-generic/vmlinux.lds.h>
8#include <asm/thread_info.h>
9#include <asm/memory.h>
10#include <asm/page.h>
11
12#define ARM_EXIT_KEEP(x)
13#define ARM_EXIT_DISCARD(x)	x
14
15OUTPUT_ARCH(aarch64)
16ENTRY(stext)
17
18jiffies = jiffies_64;
19
20#define HYPERVISOR_TEXT					\
21	/*						\
22	 * Force the alignment to be compatible with	\
23	 * the vectors requirements			\
24	 */						\
25	. = ALIGN(2048);				\
26	VMLINUX_SYMBOL(__hyp_idmap_text_start) = .;	\
27	*(.hyp.idmap.text)				\
28	VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;	\
29	VMLINUX_SYMBOL(__hyp_text_start) = .;		\
30	*(.hyp.text)					\
31	VMLINUX_SYMBOL(__hyp_text_end) = .;
32
33SECTIONS
34{
35	/*
36	 * XXX: The linker does not define how output sections are
37	 * assigned to input sections when there are multiple statements
38	 * matching the same input section name.  There is no documented
39	 * order of matching.
40	 */
41	/DISCARD/ : {
42		ARM_EXIT_DISCARD(EXIT_TEXT)
43		ARM_EXIT_DISCARD(EXIT_DATA)
44		EXIT_CALL
45		*(.discard)
46		*(.discard.*)
47	}
48
49	. = PAGE_OFFSET + TEXT_OFFSET;
50
51	.head.text : {
52		_text = .;
53		HEAD_TEXT
54	}
55	.text : {			/* Real text segment		*/
56		_stext = .;		/* Text and read-only data	*/
57			*(.smp.pen.text)
58			__exception_text_start = .;
59			*(.exception.text)
60			__exception_text_end = .;
61			IRQENTRY_TEXT
62			TEXT_TEXT
63			SCHED_TEXT
64			LOCK_TEXT
65			HYPERVISOR_TEXT
66			*(.fixup)
67			*(.gnu.warning)
68		. = ALIGN(16);
69		*(.got)			/* Global offset table		*/
70	}
71
72	RO_DATA(PAGE_SIZE)
73	EXCEPTION_TABLE(8)
74	NOTES
75	_etext = .;			/* End of text and rodata section */
76
77	. = ALIGN(PAGE_SIZE);
78	__init_begin = .;
79
80	INIT_TEXT_SECTION(8)
81	.exit.text : {
82		ARM_EXIT_KEEP(EXIT_TEXT)
83	}
84	. = ALIGN(16);
85	.init.data : {
86		INIT_DATA
87		INIT_SETUP(16)
88		INIT_CALLS
89		CON_INITCALL
90		SECURITY_INITCALL
91		INIT_RAM_FS
92	}
93	.exit.data : {
94		ARM_EXIT_KEEP(EXIT_DATA)
95	}
96
97	PERCPU_SECTION(64)
98
99	__init_end = .;
100	. = ALIGN(THREAD_SIZE);
101	__data_loc = .;
102
103	.data : AT(__data_loc) {
104		_data = .;		/* address in memory */
105		_sdata = .;
106
107		/*
108		 * first, the init task union, aligned
109		 * to an 8192 byte boundary.
110		 */
111		INIT_TASK_DATA(THREAD_SIZE)
112		NOSAVE_DATA
113		CACHELINE_ALIGNED_DATA(64)
114		READ_MOSTLY_DATA(64)
115
116		/*
117		 * and the usual data section
118		 */
119		DATA_DATA
120		CONSTRUCTORS
121
122		_edata = .;
123	}
124	_edata_loc = __data_loc + SIZEOF(.data);
125
126	BSS_SECTION(0, 0, 0)
127	_end = .;
128
129	STABS_DEBUG
130	.comment 0 : { *(.comment) }
131}
132
133/*
134 * The HYP init code can't be more than a page long.
135 */
136ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end),
137       "HYP init code too big")
138