aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-04-15 15:52:28 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-16 17:46:14 -0400
commit366234f657879aeb7a1e2ca582f2f24f3fae9269 (patch)
tree17dc5ce69cecc5ea61b78d8f71fb7d189e6a8e83 /arch
parentd04ceb3fc294ea2c4f538a04343f3a473953a3b0 (diff)
[POWERPC] Update linker script to properly set physical addresses
We can set LOAD_OFFSET and use the AT attribute on sections and the linker will properly set the physical address of the LOAD program header for us. This allows us to know how the PHYSICAL_START the user configured a kernel with by just looking at the resulting vmlinux ELF. This is pretty much stolen from how x86 does things in their linker scripts. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S47
1 files changed, 23 insertions, 24 deletions
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index b5a76bcd95a..0c3000bf8d7 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -31,7 +31,7 @@ SECTIONS
31 */ 31 */
32 32
33 /* Text and gots */ 33 /* Text and gots */
34 .text : { 34 .text : AT(ADDR(.text) - LOAD_OFFSET) {
35 ALIGN_FUNCTION(); 35 ALIGN_FUNCTION();
36 *(.text.head) 36 *(.text.head)
37 _text = .; 37 _text = .;
@@ -56,7 +56,7 @@ SECTIONS
56 RODATA 56 RODATA
57 57
58 /* Exception & bug tables */ 58 /* Exception & bug tables */
59 __ex_table : { 59 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
60 __start___ex_table = .; 60 __start___ex_table = .;
61 *(__ex_table) 61 *(__ex_table)
62 __stop___ex_table = .; 62 __stop___ex_table = .;
@@ -72,7 +72,7 @@ SECTIONS
72 . = ALIGN(PAGE_SIZE); 72 . = ALIGN(PAGE_SIZE);
73 __init_begin = .; 73 __init_begin = .;
74 74
75 .init.text : { 75 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
76 _sinittext = .; 76 _sinittext = .;
77 INIT_TEXT 77 INIT_TEXT
78 _einittext = .; 78 _einittext = .;
@@ -81,11 +81,11 @@ SECTIONS
81 /* .exit.text is discarded at runtime, not link time, 81 /* .exit.text is discarded at runtime, not link time,
82 * to deal with references from __bug_table 82 * to deal with references from __bug_table
83 */ 83 */
84 .exit.text : { 84 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
85 EXIT_TEXT 85 EXIT_TEXT
86 } 86 }
87 87
88 .init.data : { 88 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
89 INIT_DATA 89 INIT_DATA
90 __vtop_table_begin = .; 90 __vtop_table_begin = .;
91 *(.vtop_fixup); 91 *(.vtop_fixup);
@@ -101,19 +101,19 @@ SECTIONS
101 } 101 }
102 102
103 . = ALIGN(16); 103 . = ALIGN(16);
104 .init.setup : { 104 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
105 __setup_start = .; 105 __setup_start = .;
106 *(.init.setup) 106 *(.init.setup)
107 __setup_end = .; 107 __setup_end = .;
108 } 108 }
109 109
110 .initcall.init : { 110 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
111 __initcall_start = .; 111 __initcall_start = .;
112 INITCALLS 112 INITCALLS
113 __initcall_end = .; 113 __initcall_end = .;
114 } 114 }
115 115
116 .con_initcall.init : { 116 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
117 __con_initcall_start = .; 117 __con_initcall_start = .;
118 *(.con_initcall.init) 118 *(.con_initcall.init)
119 __con_initcall_end = .; 119 __con_initcall_end = .;
@@ -122,14 +122,14 @@ SECTIONS
122 SECURITY_INIT 122 SECURITY_INIT
123 123
124 . = ALIGN(8); 124 . = ALIGN(8);
125 __ftr_fixup : { 125 __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
126 __start___ftr_fixup = .; 126 __start___ftr_fixup = .;
127 *(__ftr_fixup) 127 *(__ftr_fixup)
128 __stop___ftr_fixup = .; 128 __stop___ftr_fixup = .;
129 } 129 }
130#ifdef CONFIG_PPC64 130#ifdef CONFIG_PPC64
131 . = ALIGN(8); 131 . = ALIGN(8);
132 __fw_ftr_fixup : { 132 __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) {
133 __start___fw_ftr_fixup = .; 133 __start___fw_ftr_fixup = .;
134 *(__fw_ftr_fixup) 134 *(__fw_ftr_fixup)
135 __stop___fw_ftr_fixup = .; 135 __stop___fw_ftr_fixup = .;
@@ -137,14 +137,14 @@ SECTIONS
137#endif 137#endif
138#ifdef CONFIG_BLK_DEV_INITRD 138#ifdef CONFIG_BLK_DEV_INITRD
139 . = ALIGN(PAGE_SIZE); 139 . = ALIGN(PAGE_SIZE);
140 .init.ramfs : { 140 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
141 __initramfs_start = .; 141 __initramfs_start = .;
142 *(.init.ramfs) 142 *(.init.ramfs)
143 __initramfs_end = .; 143 __initramfs_end = .;
144 } 144 }
145#endif 145#endif
146 . = ALIGN(PAGE_SIZE); 146 . = ALIGN(PAGE_SIZE);
147 .data.percpu : { 147 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
148 __per_cpu_start = .; 148 __per_cpu_start = .;
149 *(.data.percpu) 149 *(.data.percpu)
150 *(.data.percpu.shared_aligned) 150 *(.data.percpu.shared_aligned)
@@ -152,7 +152,7 @@ SECTIONS
152 } 152 }
153 153
154 . = ALIGN(8); 154 . = ALIGN(8);
155 .machine.desc : { 155 .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) {
156 __machine_desc_start = . ; 156 __machine_desc_start = . ;
157 *(.machine.desc) 157 *(.machine.desc)
158 __machine_desc_end = . ; 158 __machine_desc_end = . ;
@@ -170,25 +170,24 @@ SECTIONS
170 _sdata = .; 170 _sdata = .;
171 171
172#ifdef CONFIG_PPC32 172#ifdef CONFIG_PPC32
173 .data : 173 .data : AT(ADDR(.data) - LOAD_OFFSET) {
174 {
175 DATA_DATA 174 DATA_DATA
176 *(.sdata) 175 *(.sdata)
177 *(.got.plt) *(.got) 176 *(.got.plt) *(.got)
178 } 177 }
179#else 178#else
180 .data : { 179 .data : AT(ADDR(.data) - LOAD_OFFSET) {
181 DATA_DATA 180 DATA_DATA
182 *(.data.rel*) 181 *(.data.rel*)
183 *(.toc1) 182 *(.toc1)
184 *(.branch_lt) 183 *(.branch_lt)
185 } 184 }
186 185
187 .opd : { 186 .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
188 *(.opd) 187 *(.opd)
189 } 188 }
190 189
191 .got : { 190 .got : AT(ADDR(.got) - LOAD_OFFSET) {
192 __toc_start = .; 191 __toc_start = .;
193 *(.got) 192 *(.got)
194 *(.toc) 193 *(.toc)
@@ -205,26 +204,26 @@ SECTIONS
205#else 204#else
206 . = ALIGN(16384); 205 . = ALIGN(16384);
207#endif 206#endif
208 .data.init_task : { 207 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
209 *(.data.init_task) 208 *(.data.init_task)
210 } 209 }
211 210
212 . = ALIGN(PAGE_SIZE); 211 . = ALIGN(PAGE_SIZE);
213 .data.page_aligned : { 212 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
214 *(.data.page_aligned) 213 *(.data.page_aligned)
215 } 214 }
216 215
217 .data.cacheline_aligned : { 216 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
218 *(.data.cacheline_aligned) 217 *(.data.cacheline_aligned)
219 } 218 }
220 219
221 . = ALIGN(L1_CACHE_BYTES); 220 . = ALIGN(L1_CACHE_BYTES);
222 .data.read_mostly : { 221 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
223 *(.data.read_mostly) 222 *(.data.read_mostly)
224 } 223 }
225 224
226 . = ALIGN(PAGE_SIZE); 225 . = ALIGN(PAGE_SIZE);
227 __data_nosave : { 226 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
228 __nosave_begin = .; 227 __nosave_begin = .;
229 *(.data.nosave) 228 *(.data.nosave)
230 . = ALIGN(PAGE_SIZE); 229 . = ALIGN(PAGE_SIZE);
@@ -235,7 +234,7 @@ SECTIONS
235 * And finally the bss 234 * And finally the bss
236 */ 235 */
237 236
238 .bss : { 237 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
239 __bss_start = .; 238 __bss_start = .;
240 *(.sbss) *(.scommon) 239 *(.sbss) *(.scommon)
241 *(.dynbss) 240 *(.dynbss)