xref: /openbmc/linux/arch/sparc/kernel/vmlinux.lds.S (revision 1b1fbbcaad56ede1442e7074bd935a2c98b99596)
1/* ld script for sparc32/sparc64 kernel */
2
3#include <asm-generic/vmlinux.lds.h>
4#include <asm/page.h>
5
6#ifdef CONFIG_SPARC32
7#define INITIAL_ADDRESS  0x10000 + SIZEOF_HEADERS
8#define TEXTSTART	0xf0004000
9
10#define SMP_CACHE_BYTES_SHIFT 5
11
12#else
13#define SMP_CACHE_BYTES_SHIFT 6
14#define INITIAL_ADDRESS 0x4000
15#define TEXTSTART      0x0000000000404000
16
17#endif
18
19#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)
20
21#ifdef CONFIG_SPARC32
22OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
23OUTPUT_ARCH(sparc)
24ENTRY(_start)
25jiffies = jiffies_64 + 4;
26#else
27/* sparc64 */
28OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
29OUTPUT_ARCH(sparc:v9a)
30ENTRY(_start)
31jiffies = jiffies_64;
32#endif
33
34SECTIONS
35{
36	/* swapper_low_pmd_dir is sparc64 only */
37	swapper_low_pmd_dir = 0x0000000000402000;
38	. = INITIAL_ADDRESS;
39	.text TEXTSTART :
40	{
41		_text = .;
42		*(.text.head)
43		TEXT_TEXT
44		SCHED_TEXT
45		LOCK_TEXT
46		KPROBES_TEXT
47		*(.gnu.warning)
48	} = 0
49	_etext = .;
50	PROVIDE (etext = .);
51
52	RO_DATA(PAGE_SIZE)
53	.data :	{
54		DATA_DATA
55		CONSTRUCTORS
56	}
57	.data1 : {
58		*(.data1)
59	}
60	. = ALIGN(SMP_CACHE_BYTES);
61	.data.cacheline_aligned : {
62		*(.data.cacheline_aligned)
63	}
64	. = ALIGN(SMP_CACHE_BYTES);
65	.data.read_mostly : {
66		*(.data.read_mostly)
67	}
68	_edata = .;
69	PROVIDE (edata = .);
70	.fixup : {
71		__start___fixup = .;
72		*(.fixup)
73		__stop___fixup = .;
74	}
75	. = ALIGN(16);
76	__ex_table : {
77		__start___ex_table = .;
78		*(__ex_table)
79		__stop___ex_table = .;
80	}
81	NOTES
82
83	. = ALIGN(PAGE_SIZE);
84	.init.text : {
85		__init_begin = .;
86		_sinittext = .;
87		INIT_TEXT
88		_einittext = .;
89	}
90	__init_text_end = .;
91	.init.data : {
92		INIT_DATA
93	}
94	. = ALIGN(16);
95	.init.setup : {
96		__setup_start = .;
97		*(.init.setup)
98		__setup_end = .;
99	}
100	.initcall.init : {
101		__initcall_start = .;
102		INITCALLS
103		__initcall_end = .;
104	}
105	.con_initcall.init : {
106		__con_initcall_start = .;
107		*(.con_initcall.init)
108		__con_initcall_end = .;
109	}
110	SECURITY_INIT
111
112	. = ALIGN(4);
113	.tsb_ldquad_phys_patch : {
114		__tsb_ldquad_phys_patch = .;
115		*(.tsb_ldquad_phys_patch)
116		__tsb_ldquad_phys_patch_end = .;
117	}
118
119	.tsb_phys_patch : {
120		__tsb_phys_patch = .;
121		*(.tsb_phys_patch)
122		__tsb_phys_patch_end = .;
123	}
124
125	.cpuid_patch : {
126		__cpuid_patch = .;
127		*(.cpuid_patch)
128		__cpuid_patch_end = .;
129	}
130
131	.sun4v_1insn_patch : {
132		__sun4v_1insn_patch = .;
133		*(.sun4v_1insn_patch)
134		__sun4v_1insn_patch_end = .;
135	}
136	.sun4v_2insn_patch : {
137		__sun4v_2insn_patch = .;
138		*(.sun4v_2insn_patch)
139		__sun4v_2insn_patch_end = .;
140	}
141
142#ifdef CONFIG_BLK_DEV_INITRD
143	. = ALIGN(PAGE_SIZE);
144	.init.ramfs : {
145		__initramfs_start = .;
146		*(.init.ramfs)
147		__initramfs_end = .;
148	}
149#endif
150
151	PERCPU(PAGE_SIZE)
152
153	. = ALIGN(PAGE_SIZE);
154	__init_end = .;
155	__bss_start = .;
156	.sbss : {
157		*(.sbss)
158		*(.scommon)
159	}
160	.bss : {
161		*(.dynbss)
162		*(.bss)
163		*(COMMON)
164	}
165	_end = . ;
166	PROVIDE (end = .);
167
168	/DISCARD/ : {
169		EXIT_TEXT
170		EXIT_DATA
171		*(.exitcall.exit)
172	}
173
174	STABS_DEBUG
175	DWARF_DEBUG
176}
177