xref: /linux/arch/parisc/kernel/vmlinux.lds.S (revision 2751153b)
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	__init_begin = .;
61	HEAD_TEXT_SECTION
62	MLONGCALL_DISCARD(INIT_TEXT_SECTION(8))
63
64	. = ALIGN(PAGE_SIZE);
65	INIT_DATA_SECTION(PAGE_SIZE)
66	MLONGCALL_DISCARD(EXIT_TEXT_SECTIONS())
67	.exit.data :
68	{
69		EXIT_DATA
70	}
71	PERCPU_SECTION(8)
72	. = ALIGN(4);
73	.altinstructions : {
74		__alt_instructions = .;
75		*(.altinstructions)
76		__alt_instructions_end = .;
77	}
78	. = ALIGN(HUGEPAGE_SIZE);
79	__init_end = .;
80	/* freed after init ends here */
81
82	_text = .;		/* Text and read-only data */
83	_stext = .;
84	MLONGCALL_KEEP(INIT_TEXT_SECTION(8))
85	.text ALIGN(PAGE_SIZE) : {
86		TEXT_TEXT
87		LOCK_TEXT
88		SCHED_TEXT
89		KPROBES_TEXT
90		IRQENTRY_TEXT
91		SOFTIRQENTRY_TEXT
92		*(.text.do_softirq)
93		*(.text.sys_exit)
94		*(.text.do_sigaltstack)
95		*(.text.do_fork)
96		*(.text.div)
97		*($$*)			/* millicode routines */
98		*(.text.*)
99		*(.fixup)
100		*(.lock.text)		/* out-of-line lock text */
101		*(.gnu.warning)
102	}
103	MLONGCALL_KEEP(EXIT_TEXT_SECTIONS())
104	. = ALIGN(PAGE_SIZE);
105	_etext = .;
106	/* End of text section */
107
108	/* Start of data section */
109	_sdata = .;
110
111	/* Architecturally we need to keep __gp below 0x1000000 and thus
112	 * in front of RO_DATA() which stores lots of tracepoint
113	 * and ftrace symbols. */
114#ifdef CONFIG_64BIT
115	. = ALIGN(16);
116	/* Linkage tables */
117	.opd : {
118		__start_opd = .;
119		*(.opd)
120		__end_opd = .;
121	} PROVIDE (__gp = .);
122	.plt : {
123		*(.plt)
124	}
125	.dlt : {
126		*(.dlt)
127	}
128#endif
129
130	RO_DATA(PAGE_SIZE)
131
132	/* unwind info */
133	. = ALIGN(4);
134	.PARISC.unwind : {
135		__start___unwind = .;
136		*(.PARISC.unwind)
137		__stop___unwind = .;
138	}
139
140	/* writeable */
141	/* Make sure this is page aligned so
142	 * that we can properly leave these
143	 * as writable
144	 */
145	. = ALIGN(HUGEPAGE_SIZE);
146	data_start = .;
147
148	/* Data */
149	RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, PAGE_SIZE)
150
151	/* PA-RISC locks requires 16-byte alignment */
152	. = ALIGN(16);
153	.data..lock_aligned : {
154		*(.data..lock_aligned)
155	}
156
157	/* End of data section */
158	. = ALIGN(PAGE_SIZE);
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