xref: /openbmc/linux/arch/sparc/kernel/vmlinux.lds.S (revision c9174047b48d700a785b633319dd7d27288b86be)
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
536727ad9eSChris Metcalf		CPUIDLE_TEXT
541da177e4SLinus Torvalds		LOCK_TEXT
551b1fbbcaSSam Ravnborg		KPROBES_TEXT
569960e9e8SDavid S. Miller		IRQENTRY_TEXT
57be7635e7SAlexander Potapenko		SOFTIRQENTRY_TEXT
581da177e4SLinus Torvalds		*(.gnu.warning)
591da177e4SLinus Torvalds	} = 0
601da177e4SLinus Torvalds	_etext = .;
611b1fbbcaSSam Ravnborg
621b1fbbcaSSam Ravnborg	RO_DATA(PAGE_SIZE)
638b8d8e28SDavid S. Miller
648b8d8e28SDavid S. Miller	/* Start of data section */
658b8d8e28SDavid S. Miller	_sdata = .;
668b8d8e28SDavid S. Miller
67bcbe40ebSSam Ravnborg	.data1 : {
68bcbe40ebSSam Ravnborg		*(.data1)
69bcbe40ebSSam Ravnborg	}
70*c9174047SKees Cook	RW_DATA(SMP_CACHE_BYTES, 0, THREAD_SIZE)
713240a77bSGeoffrey Thomas
72b74e34dbSSam Ravnborg	/* End of data section */
731da177e4SLinus Torvalds	_edata = .;
74b74e34dbSSam Ravnborg
75bcbe40ebSSam Ravnborg	.fixup : {
761da177e4SLinus Torvalds		__start___fixup = .;
77bcbe40ebSSam Ravnborg		*(.fixup)
781da177e4SLinus Torvalds		__stop___fixup = .;
79bcbe40ebSSam Ravnborg	}
803240a77bSGeoffrey Thomas	EXCEPTION_TABLE(16)
810c0d345eSDavid S. Miller
82bcbe40ebSSam Ravnborg	. = ALIGN(PAGE_SIZE);
833240a77bSGeoffrey Thomas	__init_begin = ALIGN(PAGE_SIZE);
843240a77bSGeoffrey Thomas	INIT_TEXT_SECTION(PAGE_SIZE)
85bcbe40ebSSam Ravnborg	__init_text_end = .;
863240a77bSGeoffrey Thomas	INIT_DATA_SECTION(16)
8767d38229SJean-Paul Saman
881b1fbbcaSSam Ravnborg	. = ALIGN(4);
891b1fbbcaSSam Ravnborg	.tsb_ldquad_phys_patch : {
901b1fbbcaSSam Ravnborg		__tsb_ldquad_phys_patch = .;
911b1fbbcaSSam Ravnborg		*(.tsb_ldquad_phys_patch)
921b1fbbcaSSam Ravnborg		__tsb_ldquad_phys_patch_end = .;
931b1fbbcaSSam Ravnborg	}
941b1fbbcaSSam Ravnborg
951b1fbbcaSSam Ravnborg	.tsb_phys_patch : {
961b1fbbcaSSam Ravnborg		__tsb_phys_patch = .;
971b1fbbcaSSam Ravnborg		*(.tsb_phys_patch)
981b1fbbcaSSam Ravnborg		__tsb_phys_patch_end = .;
991b1fbbcaSSam Ravnborg	}
1001b1fbbcaSSam Ravnborg
1011b1fbbcaSSam Ravnborg	.cpuid_patch : {
1021b1fbbcaSSam Ravnborg		__cpuid_patch = .;
1031b1fbbcaSSam Ravnborg		*(.cpuid_patch)
1041b1fbbcaSSam Ravnborg		__cpuid_patch_end = .;
1051b1fbbcaSSam Ravnborg	}
1061b1fbbcaSSam Ravnborg
1071b1fbbcaSSam Ravnborg	.sun4v_1insn_patch : {
1081b1fbbcaSSam Ravnborg		__sun4v_1insn_patch = .;
1091b1fbbcaSSam Ravnborg		*(.sun4v_1insn_patch)
1101b1fbbcaSSam Ravnborg		__sun4v_1insn_patch_end = .;
1111b1fbbcaSSam Ravnborg	}
1121b1fbbcaSSam Ravnborg	.sun4v_2insn_patch : {
1131b1fbbcaSSam Ravnborg		__sun4v_2insn_patch = .;
1141b1fbbcaSSam Ravnborg		*(.sun4v_2insn_patch)
1151b1fbbcaSSam Ravnborg		__sun4v_2insn_patch_end = .;
1161b1fbbcaSSam Ravnborg	}
1175b8b93c4SSam Ravnborg	.leon_1insn_patch : {
1185b8b93c4SSam Ravnborg		__leon_1insn_patch = .;
1195b8b93c4SSam Ravnborg		*(.leon_1insn_patch)
1205b8b93c4SSam Ravnborg		__leon_1insn_patch_end = .;
1215b8b93c4SSam Ravnborg	}
1229076d0e7SDavid S. Miller	.swapper_tsb_phys_patch : {
1239076d0e7SDavid S. Miller		__swapper_tsb_phys_patch = .;
1249076d0e7SDavid S. Miller		*(.swapper_tsb_phys_patch)
1259076d0e7SDavid S. Miller		__swapper_tsb_phys_patch_end = .;
1269076d0e7SDavid S. Miller	}
1279076d0e7SDavid S. Miller	.swapper_4m_tsb_phys_patch : {
1289076d0e7SDavid S. Miller		__swapper_4m_tsb_phys_patch = .;
1299076d0e7SDavid S. Miller		*(.swapper_4m_tsb_phys_patch)
1309076d0e7SDavid S. Miller		__swapper_4m_tsb_phys_patch_end = .;
1319076d0e7SDavid S. Miller	}
132ef7c4d46SDavid S. Miller	.popc_3insn_patch : {
133ef7c4d46SDavid S. Miller		__popc_3insn_patch = .;
134ef7c4d46SDavid S. Miller		*(.popc_3insn_patch)
135ef7c4d46SDavid S. Miller		__popc_3insn_patch_end = .;
136ef7c4d46SDavid S. Miller	}
13756d205ccSDavid S. Miller	.popc_6insn_patch : {
13856d205ccSDavid S. Miller		__popc_6insn_patch = .;
13956d205ccSDavid S. Miller		*(.popc_6insn_patch)
14056d205ccSDavid S. Miller		__popc_6insn_patch_end = .;
14156d205ccSDavid S. Miller	}
142187818cdSDavid S. Miller	.pause_3insn_patch : {
143187818cdSDavid S. Miller		__pause_3insn_patch = .;
144187818cdSDavid S. Miller		*(.pause_3insn_patch)
145187818cdSDavid S. Miller		__pause_3insn_patch_end = .;
146e9b9eb59SDavid S. Miller	}
14774a04967SKhalid Aziz	.sun_m7_1insn_patch : {
14874a04967SKhalid Aziz		__sun_m7_1insn_patch = .;
14974a04967SKhalid Aziz		*(.sun_m7_1insn_patch)
15074a04967SKhalid Aziz		__sun_m7_1insn_patch_end = .;
15174a04967SKhalid Aziz	}
152494e5b6fSKhalid Aziz	.sun_m7_2insn_patch : {
153494e5b6fSKhalid Aziz		__sun_m7_2insn_patch = .;
154494e5b6fSKhalid Aziz		*(.sun_m7_2insn_patch)
155494e5b6fSKhalid Aziz		__sun_m7_2insn_patch_end = .;
156494e5b6fSKhalid Aziz	}
1574929c83aSPavel Tatashin	.get_tick_patch : {
1584929c83aSPavel Tatashin		__get_tick_patch = .;
1594929c83aSPavel Tatashin		*(.get_tick_patch)
1604929c83aSPavel Tatashin		__get_tick_patch_end = .;
1614929c83aSPavel Tatashin	}
162df7b2155SNitin Gupta	.pud_huge_patch : {
163df7b2155SNitin Gupta		__pud_huge_patch = .;
164df7b2155SNitin Gupta		*(.pud_huge_patch)
165df7b2155SNitin Gupta		__pud_huge_patch_end = .;
166df7b2155SNitin Gupta	}
167a7159a87SAnthony Yznaga	.fast_win_ctrl_1insn_patch : {
168a7159a87SAnthony Yznaga		__fast_win_ctrl_1insn_patch = .;
169a7159a87SAnthony Yznaga		*(.fast_win_ctrl_1insn_patch)
170a7159a87SAnthony Yznaga		__fast_win_ctrl_1insn_patch_end = .;
171a7159a87SAnthony Yznaga	}
1720415b00dSTejun Heo	PERCPU_SECTION(SMP_CACHE_BYTES)
1731b1fbbcaSSam Ravnborg
17410d7227bSJason Baron#ifdef CONFIG_JUMP_LABEL
17510d7227bSJason Baron	. = ALIGN(PAGE_SIZE);
17610d7227bSJason Baron	.exit.text : {
17710d7227bSJason Baron		EXIT_TEXT
17810d7227bSJason Baron	}
17910d7227bSJason Baron#endif
18010d7227bSJason Baron
181bcbe40ebSSam Ravnborg	. = ALIGN(PAGE_SIZE);
1821da177e4SLinus Torvalds	__init_end = .;
1833240a77bSGeoffrey Thomas	BSS_SECTION(0, 0, 0)
1841da177e4SLinus Torvalds	_end = . ;
1851b1fbbcaSSam Ravnborg
186d5784b57SDavid S. Miller	STABS_DEBUG
187d5784b57SDavid S. Miller	DWARF_DEBUG
188023bf6f1STejun Heo
189023bf6f1STejun Heo	DISCARDS
1901da177e4SLinus Torvalds}
191