xref: /openbmc/linux/arch/parisc/kernel/vmlinux.lds.S (revision f32e5616)
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#include <asm-generic/vmlinux.lds.h>
22
23/* needed for the processor specific cache alignment size */
24#include <asm/cache.h>
25#include <asm/page.h>
26#include <asm/asm-offsets.h>
27#include <asm/thread_info.h>
28
29/* ld script to make hppa Linux kernel */
30#ifndef CONFIG_64BIT
31OUTPUT_FORMAT("elf32-hppa-linux")
32OUTPUT_ARCH(hppa)
33#else
34OUTPUT_FORMAT("elf64-hppa-linux")
35OUTPUT_ARCH(hppa:hppa2.0w)
36#endif
37
38ENTRY(parisc_kernel_start)
39#ifndef CONFIG_64BIT
40jiffies = jiffies_64 + 4;
41#else
42jiffies = jiffies_64;
43#endif
44SECTIONS
45{
46	. = KERNEL_BINARY_TEXT_START;
47
48	__init_begin = .;
49	HEAD_TEXT_SECTION
50	INIT_TEXT_SECTION(8)
51
52	. = ALIGN(PAGE_SIZE);
53	INIT_DATA_SECTION(PAGE_SIZE)
54	/* we have to discard exit text and such at runtime, not link time */
55	.exit.text :
56	{
57		EXIT_TEXT
58	}
59	.exit.data :
60	{
61		EXIT_DATA
62	}
63	PERCPU_SECTION(8)
64	. = ALIGN(4);
65	.altinstructions : {
66		__alt_instructions = .;
67		*(.altinstructions)
68		__alt_instructions_end = .;
69	}
70	. = ALIGN(HUGEPAGE_SIZE);
71	__init_end = .;
72	/* freed after init ends here */
73
74	_text = .;		/* Text and read-only data */
75	_stext = .;
76	.text ALIGN(PAGE_SIZE) : {
77		TEXT_TEXT
78		SCHED_TEXT
79		CPUIDLE_TEXT
80		LOCK_TEXT
81		KPROBES_TEXT
82		IRQENTRY_TEXT
83		SOFTIRQENTRY_TEXT
84		*(.text.do_softirq)
85		*(.text.sys_exit)
86		*(.text.do_sigaltstack)
87		*(.text.do_fork)
88		*(.text.div)
89		*($$*)			/* millicode routines */
90		*(.text.*)
91		*(.fixup)
92		*(.lock.text)		/* out-of-line lock text */
93		*(.gnu.warning)
94	}
95	. = ALIGN(PAGE_SIZE);
96	_etext = .;
97	/* End of text section */
98
99	/* Start of data section */
100	_sdata = .;
101
102	/* Architecturally we need to keep __gp below 0x1000000 and thus
103	 * in front of RO_DATA_SECTION() which stores lots of tracepoint
104	 * and ftrace symbols. */
105#ifdef CONFIG_64BIT
106	. = ALIGN(16);
107	/* Linkage tables */
108	.opd : {
109		__start_opd = .;
110		*(.opd)
111		__end_opd = .;
112	} PROVIDE (__gp = .);
113	.plt : {
114		*(.plt)
115	}
116	.dlt : {
117		*(.dlt)
118	}
119#endif
120
121	RO_DATA_SECTION(8)
122
123	/* RO because of BUILDTIME_EXTABLE_SORT */
124	EXCEPTION_TABLE(8)
125	NOTES
126
127	/* unwind info */
128	.PARISC.unwind : {
129		__start___unwind = .;
130		*(.PARISC.unwind)
131		__stop___unwind = .;
132	}
133
134	/* writeable */
135	/* Make sure this is page aligned so
136	 * that we can properly leave these
137	 * as writable
138	 */
139	. = ALIGN(HUGEPAGE_SIZE);
140	data_start = .;
141
142	/* Data */
143	RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, PAGE_SIZE)
144
145	/* PA-RISC locks requires 16-byte alignment */
146	. = ALIGN(16);
147	.data..lock_aligned : {
148		*(.data..lock_aligned)
149	}
150
151	/* End of data section */
152	_edata = .;
153
154	/* BSS */
155	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE)
156
157	. = ALIGN(HUGEPAGE_SIZE);
158	_end = . ;
159
160	STABS_DEBUG
161	.note 0 : { *(.note) }
162
163	/* Sections to be discarded */
164	DISCARDS
165	/DISCARD/ : {
166#ifdef CONFIG_64BIT
167		/* temporary hack until binutils is fixed to not emit these
168	 	 * for static binaries
169		 */
170		*(.interp)
171		*(.dynsym)
172		*(.dynstr)
173		*(.dynamic)
174		*(.hash)
175		*(.gnu.hash)
176#endif
177	}
178}
179