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