xref: /openbmc/linux/arch/arm64/kernel/vmlinux.lds.S (revision 9d749629)
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
20SECTIONS
21{
22	/*
23	 * XXX: The linker does not define how output sections are
24	 * assigned to input sections when there are multiple statements
25	 * matching the same input section name.  There is no documented
26	 * order of matching.
27	 */
28	/DISCARD/ : {
29		ARM_EXIT_DISCARD(EXIT_TEXT)
30		ARM_EXIT_DISCARD(EXIT_DATA)
31		EXIT_CALL
32		*(.discard)
33		*(.discard.*)
34	}
35
36	. = PAGE_OFFSET + TEXT_OFFSET;
37
38	.head.text : {
39		_text = .;
40		HEAD_TEXT
41	}
42	.text : {			/* Real text segment		*/
43		_stext = .;		/* Text and read-only data	*/
44			*(.smp.pen.text)
45			__exception_text_start = .;
46			*(.exception.text)
47			__exception_text_end = .;
48			IRQENTRY_TEXT
49			TEXT_TEXT
50			SCHED_TEXT
51			LOCK_TEXT
52			*(.fixup)
53			*(.gnu.warning)
54		. = ALIGN(16);
55		*(.got)			/* Global offset table		*/
56	}
57
58	RO_DATA(PAGE_SIZE)
59
60	_etext = .;			/* End of text and rodata section */
61
62	. = ALIGN(PAGE_SIZE);
63	__init_begin = .;
64
65	INIT_TEXT_SECTION(8)
66	.exit.text : {
67		ARM_EXIT_KEEP(EXIT_TEXT)
68	}
69	. = ALIGN(16);
70	.init.data : {
71		INIT_DATA
72		INIT_SETUP(16)
73		INIT_CALLS
74		CON_INITCALL
75		SECURITY_INITCALL
76		INIT_RAM_FS
77	}
78	.exit.data : {
79		ARM_EXIT_KEEP(EXIT_DATA)
80	}
81
82	PERCPU_SECTION(64)
83
84	__init_end = .;
85	. = ALIGN(THREAD_SIZE);
86	__data_loc = .;
87
88	.data : AT(__data_loc) {
89		_data = .;		/* address in memory */
90		_sdata = .;
91
92		/*
93		 * first, the init task union, aligned
94		 * to an 8192 byte boundary.
95		 */
96		INIT_TASK_DATA(THREAD_SIZE)
97		NOSAVE_DATA
98		CACHELINE_ALIGNED_DATA(64)
99		READ_MOSTLY_DATA(64)
100
101		/*
102		 * The exception fixup table (might need resorting at runtime)
103		 */
104		. = ALIGN(32);
105		__start___ex_table = .;
106		*(__ex_table)
107		__stop___ex_table = .;
108
109		/*
110		 * and the usual data section
111		 */
112		DATA_DATA
113		CONSTRUCTORS
114
115		_edata = .;
116	}
117	_edata_loc = __data_loc + SIZEOF(.data);
118
119	NOTES
120
121	BSS_SECTION(0, 0, 0)
122	_end = .;
123
124	STABS_DEBUG
125	.comment 0 : { *(.comment) }
126}
127