blob: 7b4b82bd1156bc8c373fb61fe4edce6ab82d6a4b [file] [log] [blame]
Paul Mundt49e6c3e2007-11-11 17:58:11 +09001/*
2 * ld script to make SuperH Linux kernel
3 * Written by Niibe Yutaka
4 */
5#include <asm/thread_info.h>
6#include <asm/cache.h>
7#include <asm-generic/vmlinux.lds.h>
8
9#ifdef CONFIG_CPU_LITTLE_ENDIAN
10OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
11#else
12OUTPUT_FORMAT("elf32-shbig-linux", "elf32-shbig-linux", "elf32-shbig-linux")
13#endif
14OUTPUT_ARCH(sh)
15ENTRY(_start)
16SECTIONS
17{
Stuart Menefyd02b08f2007-11-30 17:52:53 +090018#ifdef CONFIG_32BIT
19 . = CONFIG_PAGE_OFFSET + CONFIG_ZERO_PAGE_OFFSET;
20#else
Paul Mundt49e6c3e2007-11-11 17:58:11 +090021 . = CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START + CONFIG_ZERO_PAGE_OFFSET;
Stuart Menefyd02b08f2007-11-30 17:52:53 +090022#endif
23
Paul Mundt49e6c3e2007-11-11 17:58:11 +090024 _text = .; /* Text and read-only data */
25
26 .empty_zero_page : {
27 *(.empty_zero_page)
28 } = 0
29
30 .text : {
31 *(.text.head)
32 TEXT_TEXT
33 SCHED_TEXT
34 LOCK_TEXT
35 KPROBES_TEXT
36 *(.fixup)
37 *(.gnu.warning)
38 } = 0x0009
39
40 . = ALIGN(16); /* Exception table */
41 __start___ex_table = .;
42 __ex_table : { *(__ex_table) }
43 __stop___ex_table = .;
44
45 _etext = .; /* End of text section */
46
Paul Mundt49e6c3e2007-11-11 17:58:11 +090047 NOTES
48 RO_DATA(PAGE_SIZE)
49
Stuart Menefycbaa1182007-11-30 17:06:36 +090050 /*
51 * Code which must be executed uncached and the associated data
52 */
53 . = ALIGN(PAGE_SIZE);
54 __uncached_start = .;
55 .uncached.text : { *(.uncached.text) }
56 .uncached.data : { *(.uncached.data) }
57 __uncached_end = .;
58
Paul Mundt49e6c3e2007-11-11 17:58:11 +090059 . = ALIGN(THREAD_SIZE);
60 .data : { /* Data */
61 *(.data.init_task)
62
63 . = ALIGN(L1_CACHE_BYTES);
64 *(.data.cacheline_aligned)
65
66 . = ALIGN(L1_CACHE_BYTES);
67 *(.data.read_mostly)
68
69 . = ALIGN(PAGE_SIZE);
70 *(.data.page_aligned)
71
72 __nosave_begin = .;
73 *(.data.nosave)
74 . = ALIGN(PAGE_SIZE);
75 __nosave_end = .;
76
77 DATA_DATA
78 CONSTRUCTORS
79 }
80
81 _edata = .; /* End of data section */
82
83 . = ALIGN(PAGE_SIZE); /* Init code and data */
84 __init_begin = .;
85 _sinittext = .;
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +010086 .init.text : { INIT_TEXT }
Paul Mundt49e6c3e2007-11-11 17:58:11 +090087 _einittext = .;
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +010088 .init.data : { INIT_DATA }
Paul Mundt49e6c3e2007-11-11 17:58:11 +090089
90 . = ALIGN(16);
91 __setup_start = .;
92 .init.setup : { *(.init.setup) }
93 __setup_end = .;
94
95 __initcall_start = .;
96 .initcall.init : {
97 INITCALLS
98 }
99 __initcall_end = .;
100 __con_initcall_start = .;
101 .con_initcall.init : { *(.con_initcall.init) }
102 __con_initcall_end = .;
103
104 SECURITY_INIT
105
106#ifdef CONFIG_BLK_DEV_INITRD
107 . = ALIGN(PAGE_SIZE);
108 __initramfs_start = .;
109 .init.ramfs : { *(.init.ramfs) }
110 __initramfs_end = .;
111#endif
112
113 . = ALIGN(4);
114 __machvec_start = .;
115 .machvec.init : { *(.machvec.init) }
116 __machvec_end = .;
117
118 PERCPU(PAGE_SIZE)
119
120 /*
121 * .exit.text is discarded at runtime, not link time, to deal with
122 * references from __bug_table
123 */
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100124 .exit.text : { EXIT_TEXT }
125 .exit.data : { EXIT_DATA }
Paul Mundt49e6c3e2007-11-11 17:58:11 +0900126
127 . = ALIGN(PAGE_SIZE);
128 .bss : {
129 __init_end = .;
130 __bss_start = .; /* BSS */
131 *(.bss.page_aligned)
132 *(.bss)
133 *(COMMON)
134 . = ALIGN(4);
135 _ebss = .; /* uClinux MTD sucks */
136 _end = . ;
137 }
138
139 /*
140 * When something in the kernel is NOT compiled as a module, the
141 * module cleanup code and data are put into these segments. Both
142 * can then be thrown away, as cleanup code is never called unless
143 * it's a module.
144 */
145 /DISCARD/ : {
146 *(.exitcall.exit)
147 }
148
149 STABS_DEBUG
150 DWARF_DEBUG
151}