| 
									
										
										
										
											2008-11-29 21:44:32 -08:00
										 |  |  | /* ld script for sparc32/sparc64 kernel */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <asm-generic/vmlinux.lds.h> | 
					
						
							| 
									
										
										
										
											2008-12-27 00:34:41 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | #include <asm/page.h> | 
					
						
							| 
									
										
										
										
											2008-12-27 00:34:41 -08:00
										 |  |  | #include <asm/thread_info.h> | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-29 21:44:32 -08:00
										 |  |  | #ifdef CONFIG_SPARC32 | 
					
						
							|  |  |  | #define INITIAL_ADDRESS  0x10000 + SIZEOF_HEADERS | 
					
						
							|  |  |  | #define TEXTSTART	0xf0004000 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SMP_CACHE_BYTES_SHIFT 5 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #else | 
					
						
							|  |  |  | #define SMP_CACHE_BYTES_SHIFT 6 | 
					
						
							|  |  |  | #define INITIAL_ADDRESS 0x4000 | 
					
						
							|  |  |  | #define TEXTSTART      0x0000000000404000 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_SPARC32 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc") | 
					
						
							|  |  |  | OUTPUT_ARCH(sparc) | 
					
						
							|  |  |  | ENTRY(_start) | 
					
						
							|  |  |  | jiffies = jiffies_64 + 4;
 | 
					
						
							| 
									
										
										
										
											2008-11-29 21:44:32 -08:00
										 |  |  | #else | 
					
						
							|  |  |  | /* sparc64 */ | 
					
						
							|  |  |  | OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc") | 
					
						
							|  |  |  | OUTPUT_ARCH(sparc:v9a) | 
					
						
							|  |  |  | ENTRY(_start) | 
					
						
							|  |  |  | jiffies = jiffies_64;
 | 
					
						
							|  |  |  | #endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | SECTIONS | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-11-29 21:44:32 -08:00
										 |  |  | 	/* swapper_low_pmd_dir is sparc64 only */ | 
					
						
							|  |  |  | 	swapper_low_pmd_dir = 0x0000000000402000;
 | 
					
						
							|  |  |  | 	. = INITIAL_ADDRESS;
 | 
					
						
							|  |  |  | 	.text TEXTSTART : | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		_text = .;
 | 
					
						
							| 
									
										
										
										
											2009-04-25 22:11:08 -04:00
										 |  |  | 		HEAD_TEXT | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 		TEXT_TEXT | 
					
						
							|  |  |  | 		SCHED_TEXT | 
					
						
							|  |  |  | 		LOCK_TEXT | 
					
						
							| 
									
										
										
										
											2008-11-29 21:44:32 -08:00
										 |  |  | 		KPROBES_TEXT | 
					
						
							| 
									
										
										
										
											2010-04-07 04:41:33 -07:00
										 |  |  | 		IRQENTRY_TEXT | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 		*(.gnu.warning) | 
					
						
							|  |  |  | 	} = 0 | 
					
						
							|  |  |  | 	_etext = .;
 | 
					
						
							| 
									
										
										
										
											2008-11-29 21:44:32 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	RO_DATA(PAGE_SIZE) | 
					
						
							| 
									
										
										
										
											2010-04-09 00:14:35 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* Start of data section */ | 
					
						
							|  |  |  | 	_sdata = .;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 	.data1 : { | 
					
						
							|  |  |  | 		*(.data1) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-09-18 15:52:09 -04:00
										 |  |  | 	RW_DATA_SECTION(SMP_CACHE_BYTES, 0, THREAD_SIZE) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-27 00:34:41 -08:00
										 |  |  | 	/* End of data section */ | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 	_edata = .;
 | 
					
						
							| 
									
										
										
										
											2008-12-27 00:34:41 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 	.fixup : { | 
					
						
							|  |  |  | 		__start___fixup = .;
 | 
					
						
							|  |  |  | 		*(.fixup) | 
					
						
							|  |  |  | 		__stop___fixup = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-09-18 15:52:09 -04:00
										 |  |  | 	EXCEPTION_TABLE(16) | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 	NOTES | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	. = ALIGN(PAGE_SIZE);
 | 
					
						
							| 
									
										
										
										
											2009-09-18 15:52:09 -04:00
										 |  |  | 	__init_begin = ALIGN(PAGE_SIZE);
 | 
					
						
							|  |  |  | 	INIT_TEXT_SECTION(PAGE_SIZE) | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 	__init_text_end = .;
 | 
					
						
							| 
									
										
										
										
											2009-09-18 15:52:09 -04:00
										 |  |  | 	INIT_DATA_SECTION(16) | 
					
						
							| 
									
										
										
										
											2007-02-10 01:44:44 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-29 21:44:32 -08:00
										 |  |  | 	. = ALIGN(4);
 | 
					
						
							|  |  |  | 	.tsb_ldquad_phys_patch : { | 
					
						
							|  |  |  | 		__tsb_ldquad_phys_patch = .;
 | 
					
						
							|  |  |  | 		*(.tsb_ldquad_phys_patch) | 
					
						
							|  |  |  | 		__tsb_ldquad_phys_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.tsb_phys_patch : { | 
					
						
							|  |  |  | 		__tsb_phys_patch = .;
 | 
					
						
							|  |  |  | 		*(.tsb_phys_patch) | 
					
						
							|  |  |  | 		__tsb_phys_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.cpuid_patch : { | 
					
						
							|  |  |  | 		__cpuid_patch = .;
 | 
					
						
							|  |  |  | 		*(.cpuid_patch) | 
					
						
							|  |  |  | 		__cpuid_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.sun4v_1insn_patch : { | 
					
						
							|  |  |  | 		__sun4v_1insn_patch = .;
 | 
					
						
							|  |  |  | 		*(.sun4v_1insn_patch) | 
					
						
							|  |  |  | 		__sun4v_1insn_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	.sun4v_2insn_patch : { | 
					
						
							|  |  |  | 		__sun4v_2insn_patch = .;
 | 
					
						
							|  |  |  | 		*(.sun4v_2insn_patch) | 
					
						
							|  |  |  | 		__sun4v_2insn_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-05-25 21:20:09 +00:00
										 |  |  | 	.leon_1insn_patch : { | 
					
						
							|  |  |  | 		__leon_1insn_patch = .;
 | 
					
						
							|  |  |  | 		*(.leon_1insn_patch) | 
					
						
							|  |  |  | 		__leon_1insn_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-08-05 00:53:57 -07:00
										 |  |  | 	.swapper_tsb_phys_patch : { | 
					
						
							|  |  |  | 		__swapper_tsb_phys_patch = .;
 | 
					
						
							|  |  |  | 		*(.swapper_tsb_phys_patch) | 
					
						
							|  |  |  | 		__swapper_tsb_phys_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	.swapper_4m_tsb_phys_patch : { | 
					
						
							|  |  |  | 		__swapper_4m_tsb_phys_patch = .;
 | 
					
						
							|  |  |  | 		*(.swapper_4m_tsb_phys_patch) | 
					
						
							|  |  |  | 		__swapper_4m_tsb_phys_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-07-29 09:42:07 -07:00
										 |  |  | 	.popc_3insn_patch : { | 
					
						
							|  |  |  | 		__popc_3insn_patch = .;
 | 
					
						
							|  |  |  | 		*(.popc_3insn_patch) | 
					
						
							|  |  |  | 		__popc_3insn_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-08-02 20:23:34 -07:00
										 |  |  | 	.popc_6insn_patch : { | 
					
						
							|  |  |  | 		__popc_6insn_patch = .;
 | 
					
						
							|  |  |  | 		*(.popc_6insn_patch) | 
					
						
							|  |  |  | 		__popc_6insn_patch_end = .;
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-03-24 18:50:09 +01:00
										 |  |  | 	PERCPU_SECTION(SMP_CACHE_BYTES) | 
					
						
							| 
									
										
										
										
											2008-11-29 21:44:32 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 	. = ALIGN(PAGE_SIZE);
 | 
					
						
							|  |  |  | 	__init_end = .;
 | 
					
						
							| 
									
										
										
										
											2009-09-18 15:52:09 -04:00
										 |  |  | 	BSS_SECTION(0, 0, 0) | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 	_end = . ;
 | 
					
						
							| 
									
										
										
										
											2008-11-29 21:44:32 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-17 19:02:30 -07:00
										 |  |  | 	STABS_DEBUG | 
					
						
							|  |  |  | 	DWARF_DEBUG | 
					
						
							| 
									
										
											  
											
												linker script: unify usage of discard definition
Discarded sections in different archs share some commonality but have
considerable differences.  This led to linker script for each arch
implementing its own /DISCARD/ definition, which makes maintaining
tedious and adding new entries error-prone.
This patch makes all linker scripts to move discard definitions to the
end of the linker script and use the common DISCARDS macro.  As ld
uses the first matching section definition, archs can include default
discarded sections by including them earlier in the linker script.
ia64 is notable because it first throws away some ia64 specific
subsections and then include the rest of the sections into the final
image, so those sections must be discarded before the inclusion.
defconfig compile tested for x86, x86-64, powerpc, powerpc64, ia64,
alpha, sparc, sparc64 and s390.  Michal Simek tested microblaze.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Michal Simek <monstr@monstr.eu>
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Tony Luck <tony.luck@intel.com>
											
										 
											2009-07-09 11:27:40 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	DISCARDS | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } |