xref: /openbmc/linux/arch/parisc/kernel/vmlinux.lds.S (revision 37002bc6)
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(8)
131
132	/* unwind info */
133	.PARISC.unwind : {
134		__start___unwind = .;
135		*(.PARISC.unwind)
136		__stop___unwind = .;
137	}
138
139	/* writeable */
140	/* Make sure this is page aligned so
141	 * that we can properly leave these
142	 * as writable
143	 */
144	. = ALIGN(HUGEPAGE_SIZE);
145	data_start = .;
146
147	/* Data */
148	RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, PAGE_SIZE)
149
150	/* PA-RISC locks requires 16-byte alignment */
151	. = ALIGN(16);
152	.data..lock_aligned : {
153		*(.data..lock_aligned)
154	}
155
156	/* End of data section */
157	_edata = .;
158
159	/* BSS */
160	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE)
161
162	. = ALIGN(HUGEPAGE_SIZE);
163	_end = . ;
164
165	STABS_DEBUG
166	ELF_DETAILS
167	.note 0 : { *(.note) }
168
169	/* Sections to be discarded */
170	DISCARDS
171	/DISCARD/ : {
172#ifdef CONFIG_64BIT
173		/* temporary hack until binutils is fixed to not emit these
174	 	 * for static binaries
175		 */
176		*(.interp)
177		*(.dynsym)
178		*(.dynstr)
179		*(.dynamic)
180		*(.hash)
181		*(.gnu.hash)
182#endif
183	}
184}
185