xref: /openbmc/linux/arch/sparc/kernel/vmlinux.lds.S (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */
21b1fbbcaSSam Ravnborg/* ld script for sparc32/sparc64 kernel */
31da177e4SLinus Torvalds
41da177e4SLinus Torvalds#include <asm-generic/vmlinux.lds.h>
5b74e34dbSSam Ravnborg
6bcbe40ebSSam Ravnborg#include <asm/page.h>
7b74e34dbSSam Ravnborg#include <asm/thread_info.h>
81da177e4SLinus Torvalds
91b1fbbcaSSam Ravnborg#ifdef CONFIG_SPARC32
101b1fbbcaSSam Ravnborg#define INITIAL_ADDRESS  0x10000 + SIZEOF_HEADERS
111b1fbbcaSSam Ravnborg#define TEXTSTART	0xf0004000
121b1fbbcaSSam Ravnborg
131b1fbbcaSSam Ravnborg#define SMP_CACHE_BYTES_SHIFT 5
141b1fbbcaSSam Ravnborg
151b1fbbcaSSam Ravnborg#else
161b1fbbcaSSam Ravnborg#define SMP_CACHE_BYTES_SHIFT 6
171b1fbbcaSSam Ravnborg#define INITIAL_ADDRESS 0x4000
181b1fbbcaSSam Ravnborg#define TEXTSTART      0x0000000000404000
191b1fbbcaSSam Ravnborg
201b1fbbcaSSam Ravnborg#endif
211b1fbbcaSSam Ravnborg
221b1fbbcaSSam Ravnborg#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)
231b1fbbcaSSam Ravnborg
241b1fbbcaSSam Ravnborg#ifdef CONFIG_SPARC32
251da177e4SLinus TorvaldsOUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
261da177e4SLinus TorvaldsOUTPUT_ARCH(sparc)
271da177e4SLinus TorvaldsENTRY(_start)
281da177e4SLinus Torvaldsjiffies = jiffies_64 + 4;
291b1fbbcaSSam Ravnborg#else
301b1fbbcaSSam Ravnborg/* sparc64 */
311b1fbbcaSSam RavnborgOUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
321b1fbbcaSSam RavnborgOUTPUT_ARCH(sparc:v9a)
331b1fbbcaSSam RavnborgENTRY(_start)
341b1fbbcaSSam Ravnborgjiffies = jiffies_64;
351b1fbbcaSSam Ravnborg#endif
361b1fbbcaSSam Ravnborg
3749fa5230SDavid S. Miller#ifdef CONFIG_SPARC64
3849fa5230SDavid S. MillerASSERT((swapper_tsb == 0x0000000000408000), "Error: sparc64 early assembler too large")
3949fa5230SDavid S. Miller#endif
4049fa5230SDavid S. Miller
411da177e4SLinus TorvaldsSECTIONS
421da177e4SLinus Torvalds{
43d195b71bSDavid S. Miller#ifdef CONFIG_SPARC64
44d195b71bSDavid S. Miller	swapper_pg_dir = 0x0000000000402000;
45d195b71bSDavid S. Miller#endif
461b1fbbcaSSam Ravnborg	. = INITIAL_ADDRESS;
471b1fbbcaSSam Ravnborg	.text TEXTSTART :
481da177e4SLinus Torvalds	{
49fd593d12SEric W. Biederman		_text = .;
50ce8a7424STim Abbott		HEAD_TEXT
517664709bSSam Ravnborg		TEXT_TEXT
521da177e4SLinus Torvalds		SCHED_TEXT
531da177e4SLinus Torvalds		LOCK_TEXT
541b1fbbcaSSam Ravnborg		KPROBES_TEXT
559960e9e8SDavid S. Miller		IRQENTRY_TEXT
56be7635e7SAlexander Potapenko		SOFTIRQENTRY_TEXT
571da177e4SLinus Torvalds		*(.gnu.warning)
581da177e4SLinus Torvalds	} = 0
591da177e4SLinus Torvalds	_etext = .;
601b1fbbcaSSam Ravnborg
611b1fbbcaSSam Ravnborg	RO_DATA(PAGE_SIZE)
628b8d8e28SDavid S. Miller
638b8d8e28SDavid S. Miller	/* Start of data section */
648b8d8e28SDavid S. Miller	_sdata = .;
658b8d8e28SDavid S. Miller
66bcbe40ebSSam Ravnborg	.data1 : {
67bcbe40ebSSam Ravnborg		*(.data1)
68bcbe40ebSSam Ravnborg	}
69c9174047SKees Cook	RW_DATA(SMP_CACHE_BYTES, 0, THREAD_SIZE)
703240a77bSGeoffrey Thomas
71b74e34dbSSam Ravnborg	/* End of data section */
721da177e4SLinus Torvalds	_edata = .;
73b74e34dbSSam Ravnborg
74bcbe40ebSSam Ravnborg	.fixup : {
751da177e4SLinus Torvalds		__start___fixup = .;
76bcbe40ebSSam Ravnborg		*(.fixup)
771da177e4SLinus Torvalds		__stop___fixup = .;
78bcbe40ebSSam Ravnborg	}
793240a77bSGeoffrey Thomas	EXCEPTION_TABLE(16)
800c0d345eSDavid S. Miller
81bcbe40ebSSam Ravnborg	. = ALIGN(PAGE_SIZE);
823240a77bSGeoffrey Thomas	__init_begin = ALIGN(PAGE_SIZE);
833240a77bSGeoffrey Thomas	INIT_TEXT_SECTION(PAGE_SIZE)
84bcbe40ebSSam Ravnborg	__init_text_end = .;
853240a77bSGeoffrey Thomas	INIT_DATA_SECTION(16)
8667d38229SJean-Paul Saman
871b1fbbcaSSam Ravnborg	. = ALIGN(4);
881b1fbbcaSSam Ravnborg	.tsb_ldquad_phys_patch : {
891b1fbbcaSSam Ravnborg		__tsb_ldquad_phys_patch = .;
901b1fbbcaSSam Ravnborg		*(.tsb_ldquad_phys_patch)
911b1fbbcaSSam Ravnborg		__tsb_ldquad_phys_patch_end = .;
921b1fbbcaSSam Ravnborg	}
931b1fbbcaSSam Ravnborg
941b1fbbcaSSam Ravnborg	.tsb_phys_patch : {
951b1fbbcaSSam Ravnborg		__tsb_phys_patch = .;
961b1fbbcaSSam Ravnborg		*(.tsb_phys_patch)
971b1fbbcaSSam Ravnborg		__tsb_phys_patch_end = .;
981b1fbbcaSSam Ravnborg	}
991b1fbbcaSSam Ravnborg
1001b1fbbcaSSam Ravnborg	.cpuid_patch : {
1011b1fbbcaSSam Ravnborg		__cpuid_patch = .;
1021b1fbbcaSSam Ravnborg		*(.cpuid_patch)
1031b1fbbcaSSam Ravnborg		__cpuid_patch_end = .;
1041b1fbbcaSSam Ravnborg	}
1051b1fbbcaSSam Ravnborg
1061b1fbbcaSSam Ravnborg	.sun4v_1insn_patch : {
1071b1fbbcaSSam Ravnborg		__sun4v_1insn_patch = .;
1081b1fbbcaSSam Ravnborg		*(.sun4v_1insn_patch)
1091b1fbbcaSSam Ravnborg		__sun4v_1insn_patch_end = .;
1101b1fbbcaSSam Ravnborg	}
1111b1fbbcaSSam Ravnborg	.sun4v_2insn_patch : {
1121b1fbbcaSSam Ravnborg		__sun4v_2insn_patch = .;
1131b1fbbcaSSam Ravnborg		*(.sun4v_2insn_patch)
1141b1fbbcaSSam Ravnborg		__sun4v_2insn_patch_end = .;
1151b1fbbcaSSam Ravnborg	}
1165b8b93c4SSam Ravnborg	.leon_1insn_patch : {
1175b8b93c4SSam Ravnborg		__leon_1insn_patch = .;
1185b8b93c4SSam Ravnborg		*(.leon_1insn_patch)
1195b8b93c4SSam Ravnborg		__leon_1insn_patch_end = .;
1205b8b93c4SSam Ravnborg	}
1219076d0e7SDavid S. Miller	.swapper_tsb_phys_patch : {
1229076d0e7SDavid S. Miller		__swapper_tsb_phys_patch = .;
1239076d0e7SDavid S. Miller		*(.swapper_tsb_phys_patch)
1249076d0e7SDavid S. Miller		__swapper_tsb_phys_patch_end = .;
1259076d0e7SDavid S. Miller	}
1269076d0e7SDavid S. Miller	.swapper_4m_tsb_phys_patch : {
1279076d0e7SDavid S. Miller		__swapper_4m_tsb_phys_patch = .;
1289076d0e7SDavid S. Miller		*(.swapper_4m_tsb_phys_patch)
1299076d0e7SDavid S. Miller		__swapper_4m_tsb_phys_patch_end = .;
1309076d0e7SDavid S. Miller	}
131ef7c4d46SDavid S. Miller	.popc_3insn_patch : {
132ef7c4d46SDavid S. Miller		__popc_3insn_patch = .;
133ef7c4d46SDavid S. Miller		*(.popc_3insn_patch)
134ef7c4d46SDavid S. Miller		__popc_3insn_patch_end = .;
135ef7c4d46SDavid S. Miller	}
13656d205ccSDavid S. Miller	.popc_6insn_patch : {
13756d205ccSDavid S. Miller		__popc_6insn_patch = .;
13856d205ccSDavid S. Miller		*(.popc_6insn_patch)
13956d205ccSDavid S. Miller		__popc_6insn_patch_end = .;
14056d205ccSDavid S. Miller	}
141187818cdSDavid S. Miller	.pause_3insn_patch : {
142187818cdSDavid S. Miller		__pause_3insn_patch = .;
143187818cdSDavid S. Miller		*(.pause_3insn_patch)
144187818cdSDavid S. Miller		__pause_3insn_patch_end = .;
145e9b9eb59SDavid S. Miller	}
14674a04967SKhalid Aziz	.sun_m7_1insn_patch : {
14774a04967SKhalid Aziz		__sun_m7_1insn_patch = .;
14874a04967SKhalid Aziz		*(.sun_m7_1insn_patch)
14974a04967SKhalid Aziz		__sun_m7_1insn_patch_end = .;
15074a04967SKhalid Aziz	}
151494e5b6fSKhalid Aziz	.sun_m7_2insn_patch : {
152494e5b6fSKhalid Aziz		__sun_m7_2insn_patch = .;
153494e5b6fSKhalid Aziz		*(.sun_m7_2insn_patch)
154494e5b6fSKhalid Aziz		__sun_m7_2insn_patch_end = .;
155494e5b6fSKhalid Aziz	}
1564929c83aSPavel Tatashin	.get_tick_patch : {
1574929c83aSPavel Tatashin		__get_tick_patch = .;
1584929c83aSPavel Tatashin		*(.get_tick_patch)
1594929c83aSPavel Tatashin		__get_tick_patch_end = .;
1604929c83aSPavel Tatashin	}
161df7b2155SNitin Gupta	.pud_huge_patch : {
162df7b2155SNitin Gupta		__pud_huge_patch = .;
163df7b2155SNitin Gupta		*(.pud_huge_patch)
164df7b2155SNitin Gupta		__pud_huge_patch_end = .;
165df7b2155SNitin Gupta	}
166a7159a87SAnthony Yznaga	.fast_win_ctrl_1insn_patch : {
167a7159a87SAnthony Yznaga		__fast_win_ctrl_1insn_patch = .;
168a7159a87SAnthony Yznaga		*(.fast_win_ctrl_1insn_patch)
169a7159a87SAnthony Yznaga		__fast_win_ctrl_1insn_patch_end = .;
170a7159a87SAnthony Yznaga	}
1710415b00dSTejun Heo	PERCPU_SECTION(SMP_CACHE_BYTES)
1721b1fbbcaSSam Ravnborg
17310d7227bSJason Baron	. = ALIGN(PAGE_SIZE);
17410d7227bSJason Baron	.exit.text : {
17510d7227bSJason Baron		EXIT_TEXT
17610d7227bSJason Baron	}
177548f0b9aSDavid S. Miller
178548f0b9aSDavid S. Miller	.exit.data : {
179548f0b9aSDavid S. Miller		EXIT_DATA
180548f0b9aSDavid S. Miller	}
18110d7227bSJason Baron
182bcbe40ebSSam Ravnborg	. = ALIGN(PAGE_SIZE);
1831da177e4SLinus Torvalds	__init_end = .;
1843240a77bSGeoffrey Thomas	BSS_SECTION(0, 0, 0)
1851da177e4SLinus Torvalds	_end = . ;
1861b1fbbcaSSam Ravnborg
187d5784b57SDavid S. Miller	STABS_DEBUG
188d5784b57SDavid S. Miller	DWARF_DEBUG
189*c604abc3SKees Cook	ELF_DETAILS
190023bf6f1STejun Heo
191023bf6f1STejun Heo	DISCARDS
1921da177e4SLinus Torvalds}
193