xref: /openbmc/linux/arch/parisc/kernel/vmlinux.lds.S (revision 9cf0666f)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*    Kernel link layout for various "sections"
3 *
4 *    Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org>
5 *    Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org>
6 *    Copyright (C) 2000 John Marvin <jsm at parisc-linux.org>
7 *    Copyright (C) 2000 Michael Ang <mang with subcarrier.org>
8 *    Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
9 *    Copyright (C) 2003 James Bottomley <jejb with parisc-linux.org>
10 *    Copyright (C) 2006-2013 Helge Deller <deller@gmx.de>
11 */
12
13/*
14 * Put page table entries (swapper_pg_dir) as the first thing in .bss. This
15 * will ensure that it has .bss alignment (PAGE_SIZE).
16 */
17#define BSS_FIRST_SECTIONS	*(.data..vm0.pmd) \
18				*(.data..vm0.pgd) \
19				*(.data..vm0.pte)
20
21#define CC_USING_PATCHABLE_FUNCTION_ENTRY
22#define RO_EXCEPTION_TABLE_ALIGN	8
23
24#include <asm-generic/vmlinux.lds.h>
25
26/* needed for the processor specific cache alignment size */
27#include <asm/cache.h>
28#include <asm/page.h>
29#include <asm/asm-offsets.h>
30#include <asm/thread_info.h>
31
32/* ld script to make hppa Linux kernel */
33#ifndef CONFIG_64BIT
34OUTPUT_FORMAT("elf32-hppa-linux")
35OUTPUT_ARCH(hppa)
36#else
37OUTPUT_FORMAT("elf64-hppa-linux")
38OUTPUT_ARCH(hppa:hppa2.0w)
39#endif
40
41#define EXIT_TEXT_SECTIONS()	.exit.text : { EXIT_TEXT }
42#if !defined(CONFIG_64BIT) || defined(CONFIG_MLONGCALLS)
43#define MLONGCALL_KEEP(x)
44#define MLONGCALL_DISCARD(x)	x
45#else
46#define MLONGCALL_KEEP(x)	x
47#define MLONGCALL_DISCARD(x)
48#endif
49
50ENTRY(parisc_kernel_start)
51#ifndef CONFIG_64BIT
52jiffies = jiffies_64 + 4;
53#else
54jiffies = jiffies_64;
55#endif
56SECTIONS
57{
58	. = KERNEL_BINARY_TEXT_START;
59
60	_stext = .;	/* start of kernel text, includes init code & data */
61
62	__init_begin = .;
63	HEAD_TEXT_SECTION
64	MLONGCALL_DISCARD(INIT_TEXT_SECTION(8))
65
66	. = ALIGN(PAGE_SIZE);
67	INIT_DATA_SECTION(PAGE_SIZE)
68	MLONGCALL_DISCARD(EXIT_TEXT_SECTIONS())
69	.exit.data :
70	{
71		EXIT_DATA
72	}
73	PERCPU_SECTION(8)
74	. = ALIGN(4);
75	.altinstructions : {
76		__alt_instructions = .;
77		*(.altinstructions)
78		__alt_instructions_end = .;
79	}
80	. = ALIGN(HUGEPAGE_SIZE);
81	__init_end = .;
82	/* freed after init ends here */
83
84	_text = .;		/* Text and read-only data */
85	MLONGCALL_KEEP(INIT_TEXT_SECTION(8))
86	.text ALIGN(PAGE_SIZE) : {
87		TEXT_TEXT
88		LOCK_TEXT
89		SCHED_TEXT
90		CPUIDLE_TEXT
91		KPROBES_TEXT
92		IRQENTRY_TEXT
93		SOFTIRQENTRY_TEXT
94		*(.text.do_softirq)
95		*(.text.sys_exit)
96		*(.text.do_sigaltstack)
97		*(.text.do_fork)
98		*(.text.div)
99		*($$*)			/* millicode routines */
100		*(.text.*)
101		*(.fixup)
102		*(.lock.text)		/* out-of-line lock text */
103		*(.gnu.warning)
104	}
105	MLONGCALL_KEEP(EXIT_TEXT_SECTIONS())
106	. = ALIGN(PAGE_SIZE);
107	_etext = .;
108	/* End of text section */
109
110	/* Start of data section */
111	_sdata = .;
112
113	/* Architecturally we need to keep __gp below 0x1000000 and thus
114	 * in front of RO_DATA() which stores lots of tracepoint
115	 * and ftrace symbols. */
116#ifdef CONFIG_64BIT
117	. = ALIGN(16);
118	/* Linkage tables */
119	.opd : {
120		__start_opd = .;
121		*(.opd)
122		__end_opd = .;
123	} PROVIDE (__gp = .);
124	.plt : {
125		*(.plt)
126	}
127	.dlt : {
128		*(.dlt)
129	}
130#endif
131
132	RO_DATA(8)
133
134	/* unwind info */
135	.PARISC.unwind : {
136		__start___unwind = .;
137		*(.PARISC.unwind)
138		__stop___unwind = .;
139	}
140
141	/* writeable */
142	/* Make sure this is page aligned so
143	 * that we can properly leave these
144	 * as writable
145	 */
146	. = ALIGN(HUGEPAGE_SIZE);
147	data_start = .;
148
149	/* Data */
150	RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, PAGE_SIZE)
151
152	/* PA-RISC locks requires 16-byte alignment */
153	. = ALIGN(16);
154	.data..lock_aligned : {
155		*(.data..lock_aligned)
156	}
157
158	/* End of data section */
159	_edata = .;
160
161	/* BSS */
162	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE)
163
164	. = ALIGN(HUGEPAGE_SIZE);
165	_end = . ;
166
167	STABS_DEBUG
168	ELF_DETAILS
169	.note 0 : { *(.note) }
170
171	/* Sections to be discarded */
172	DISCARDS
173	/DISCARD/ : {
174#ifdef CONFIG_64BIT
175		/* temporary hack until binutils is fixed to not emit these
176	 	 * for static binaries
177		 */
178		*(.interp)
179		*(.dynsym)
180		*(.dynstr)
181		*(.dynamic)
182		*(.hash)
183		*(.gnu.hash)
184#endif
185	}
186}
187