blob: 61afd787bd0c7a7f82fef18f69aa7da6c1898425 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Sam Ravnborg1b1fbbc2008-11-29 21:44:32 -08002/* ld script for sparc32/sparc64 kernel */
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
4#include <asm-generic/vmlinux.lds.h>
Sam Ravnborgb74e34d2008-12-27 00:34:41 -08005
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -07006#include <asm/page.h>
Sam Ravnborgb74e34d2008-12-27 00:34:41 -08007#include <asm/thread_info.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
Sam Ravnborg1b1fbbc2008-11-29 21:44:32 -08009#ifdef CONFIG_SPARC32
10#define INITIAL_ADDRESS 0x10000 + SIZEOF_HEADERS
11#define TEXTSTART 0xf0004000
12
13#define SMP_CACHE_BYTES_SHIFT 5
14
15#else
16#define SMP_CACHE_BYTES_SHIFT 6
17#define INITIAL_ADDRESS 0x4000
18#define TEXTSTART 0x0000000000404000
19
20#endif
21
22#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)
23
24#ifdef CONFIG_SPARC32
Linus Torvalds1da177e2005-04-16 15:20:36 -070025OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
26OUTPUT_ARCH(sparc)
27ENTRY(_start)
28jiffies = jiffies_64 + 4;
Sam Ravnborg1b1fbbc2008-11-29 21:44:32 -080029#else
30/* sparc64 */
31OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
32OUTPUT_ARCH(sparc:v9a)
33ENTRY(_start)
34jiffies = jiffies_64;
35#endif
36
David S. Miller49fa5232016-04-27 17:27:37 -040037#ifdef CONFIG_SPARC64
38ASSERT((swapper_tsb == 0x0000000000408000), "Error: sparc64 early assembler too large")
39#endif
40
Linus Torvalds1da177e2005-04-16 15:20:36 -070041SECTIONS
42{
David S. Millerd195b712014-09-27 21:30:57 -070043#ifdef CONFIG_SPARC64
44 swapper_pg_dir = 0x0000000000402000;
45#endif
Sam Ravnborg1b1fbbc2008-11-29 21:44:32 -080046 . = INITIAL_ADDRESS;
47 .text TEXTSTART :
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -070048 {
49 _text = .;
Tim Abbottce8a7422009-04-25 22:11:08 -040050 HEAD_TEXT
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -070051 TEXT_TEXT
52 SCHED_TEXT
Chris Metcalf6727ad92016-10-07 17:02:55 -070053 CPUIDLE_TEXT
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -070054 LOCK_TEXT
Sam Ravnborg1b1fbbc2008-11-29 21:44:32 -080055 KPROBES_TEXT
David S. Miller9960e9e2010-04-07 04:41:33 -070056 IRQENTRY_TEXT
Alexander Potapenkobe7635e2016-03-25 14:22:05 -070057 SOFTIRQENTRY_TEXT
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -070058 *(.gnu.warning)
59 } = 0
60 _etext = .;
Sam Ravnborg1b1fbbc2008-11-29 21:44:32 -080061
62 RO_DATA(PAGE_SIZE)
David S. Miller8b8d8e22010-04-09 00:14:35 -070063
64 /* Start of data section */
65 _sdata = .;
66
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -070067 .data1 : {
68 *(.data1)
69 }
Geoffrey Thomas3240a772009-09-18 15:52:09 -040070 RW_DATA_SECTION(SMP_CACHE_BYTES, 0, THREAD_SIZE)
71
Sam Ravnborgb74e34d2008-12-27 00:34:41 -080072 /* End of data section */
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -070073 _edata = .;
Sam Ravnborgb74e34d2008-12-27 00:34:41 -080074
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -070075 .fixup : {
76 __start___fixup = .;
77 *(.fixup)
78 __stop___fixup = .;
79 }
Geoffrey Thomas3240a772009-09-18 15:52:09 -040080 EXCEPTION_TABLE(16)
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -070081 NOTES
82
83 . = ALIGN(PAGE_SIZE);
Geoffrey Thomas3240a772009-09-18 15:52:09 -040084 __init_begin = ALIGN(PAGE_SIZE);
85 INIT_TEXT_SECTION(PAGE_SIZE)
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -070086 __init_text_end = .;
Geoffrey Thomas3240a772009-09-18 15:52:09 -040087 INIT_DATA_SECTION(16)
Jean-Paul Saman67d38222007-02-10 01:44:44 -080088
Sam Ravnborg1b1fbbc2008-11-29 21:44:32 -080089 . = ALIGN(4);
90 .tsb_ldquad_phys_patch : {
91 __tsb_ldquad_phys_patch = .;
92 *(.tsb_ldquad_phys_patch)
93 __tsb_ldquad_phys_patch_end = .;
94 }
95
96 .tsb_phys_patch : {
97 __tsb_phys_patch = .;
98 *(.tsb_phys_patch)
99 __tsb_phys_patch_end = .;
100 }
101
102 .cpuid_patch : {
103 __cpuid_patch = .;
104 *(.cpuid_patch)
105 __cpuid_patch_end = .;
106 }
107
108 .sun4v_1insn_patch : {
109 __sun4v_1insn_patch = .;
110 *(.sun4v_1insn_patch)
111 __sun4v_1insn_patch_end = .;
112 }
113 .sun4v_2insn_patch : {
114 __sun4v_2insn_patch = .;
115 *(.sun4v_2insn_patch)
116 __sun4v_2insn_patch_end = .;
117 }
Sam Ravnborg5b8b93c2012-05-25 21:20:09 +0000118 .leon_1insn_patch : {
119 __leon_1insn_patch = .;
120 *(.leon_1insn_patch)
121 __leon_1insn_patch_end = .;
122 }
David S. Miller9076d0e2011-08-05 00:53:57 -0700123 .swapper_tsb_phys_patch : {
124 __swapper_tsb_phys_patch = .;
125 *(.swapper_tsb_phys_patch)
126 __swapper_tsb_phys_patch_end = .;
127 }
128 .swapper_4m_tsb_phys_patch : {
129 __swapper_4m_tsb_phys_patch = .;
130 *(.swapper_4m_tsb_phys_patch)
131 __swapper_4m_tsb_phys_patch_end = .;
132 }
David S. Milleref7c4d42011-07-29 09:42:07 -0700133 .popc_3insn_patch : {
134 __popc_3insn_patch = .;
135 *(.popc_3insn_patch)
136 __popc_3insn_patch_end = .;
137 }
David S. Miller56d205c2011-08-02 20:23:34 -0700138 .popc_6insn_patch : {
139 __popc_6insn_patch = .;
140 *(.popc_6insn_patch)
141 __popc_6insn_patch_end = .;
142 }
David S. Miller187818c2012-10-28 13:04:47 -0700143 .pause_3insn_patch : {
144 __pause_3insn_patch = .;
145 *(.pause_3insn_patch)
146 __pause_3insn_patch_end = .;
David S. Millere9b9eb52012-10-27 23:00:41 -0700147 }
Khalid Aziz74a04962018-02-23 15:46:41 -0700148 .sun_m7_1insn_patch : {
149 __sun_m7_1insn_patch = .;
150 *(.sun_m7_1insn_patch)
151 __sun_m7_1insn_patch_end = .;
152 }
Khalid Aziz494e5b62015-05-27 10:00:46 -0600153 .sun_m7_2insn_patch : {
154 __sun_m7_2insn_patch = .;
155 *(.sun_m7_2insn_patch)
156 __sun_m7_2insn_patch_end = .;
157 }
Pavel Tatashin4929c832017-06-12 16:41:47 -0400158 .get_tick_patch : {
159 __get_tick_patch = .;
160 *(.get_tick_patch)
161 __get_tick_patch_end = .;
162 }
Nitin Guptadf7b2152017-08-11 16:46:50 -0700163 .pud_huge_patch : {
164 __pud_huge_patch = .;
165 *(.pud_huge_patch)
166 __pud_huge_patch_end = .;
167 }
Anthony Yznagaa7159a82017-08-18 12:40:36 -0700168 .fast_win_ctrl_1insn_patch : {
169 __fast_win_ctrl_1insn_patch = .;
170 *(.fast_win_ctrl_1insn_patch)
171 __fast_win_ctrl_1insn_patch_end = .;
172 }
Tejun Heo0415b00d12011-03-24 18:50:09 +0100173 PERCPU_SECTION(SMP_CACHE_BYTES)
Sam Ravnborg1b1fbbc2008-11-29 21:44:32 -0800174
Jason Baron10d72272016-08-03 13:46:27 -0700175#ifdef CONFIG_JUMP_LABEL
176 . = ALIGN(PAGE_SIZE);
177 .exit.text : {
178 EXIT_TEXT
179 }
180#endif
181
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -0700182 . = ALIGN(PAGE_SIZE);
183 __init_end = .;
Geoffrey Thomas3240a772009-09-18 15:52:09 -0400184 BSS_SECTION(0, 0, 0)
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -0700185 _end = . ;
Sam Ravnborg1b1fbbc2008-11-29 21:44:32 -0800186
Sam Ravnborgbcbe40e2007-09-17 19:02:30 -0700187 STABS_DEBUG
188 DWARF_DEBUG
Tejun Heo023bf6f2009-07-09 11:27:40 +0900189
190 DISCARDS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191}