xref: /openbmc/linux/arch/parisc/kernel/vmlinux.lds.S (revision 505b0877)
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		CPUIDLE_TEXT
90		KPROBES_TEXT
91		IRQENTRY_TEXT
92		SOFTIRQENTRY_TEXT
93		*(.text.do_softirq)
94		*(.text.sys_exit)
95		*(.text.do_sigaltstack)
96		*(.text.do_fork)
97		*(.text.div)
98		*($$*)			/* millicode routines */
99		*(.text.*)
100		*(.fixup)
101		*(.lock.text)		/* out-of-line lock text */
102		*(.gnu.warning)
103	}
104	MLONGCALL_KEEP(EXIT_TEXT_SECTIONS())
105	. = ALIGN(PAGE_SIZE);
106	_etext = .;
107	/* End of text section */
108
109	/* Start of data section */
110	_sdata = .;
111
112	/* Architecturally we need to keep __gp below 0x1000000 and thus
113	 * in front of RO_DATA() which stores lots of tracepoint
114	 * and ftrace symbols. */
115#ifdef CONFIG_64BIT
116	. = ALIGN(16);
117	/* Linkage tables */
118	.opd : {
119		__start_opd = .;
120		*(.opd)
121		__end_opd = .;
122	} PROVIDE (__gp = .);
123	.plt : {
124		*(.plt)
125	}
126	.dlt : {
127		*(.dlt)
128	}
129#endif
130
131	RO_DATA(8)
132
133	/* unwind info */
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	_edata = .;
159
160	/* BSS */
161	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE)
162
163	. = ALIGN(HUGEPAGE_SIZE);
164	_end = . ;
165
166	STABS_DEBUG
167	ELF_DETAILS
168	.note 0 : { *(.note) }
169
170	/* Sections to be discarded */
171	DISCARDS
172	/DISCARD/ : {
173#ifdef CONFIG_64BIT
174		/* temporary hack until binutils is fixed to not emit these
175	 	 * for static binaries
176		 */
177		*(.interp)
178		*(.dynsym)
179		*(.dynstr)
180		*(.dynamic)
181		*(.hash)
182		*(.gnu.hash)
183#endif
184	}
185}
186