aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2009-04-29 03:47:18 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-29 04:20:29 -0400
commit17ce265d6a1789eae5eb739a3bb7fcffdb3e87c5 (patch)
treed6c514343dc5713042117c001b1cf38147789337
parentaee6a166a5401dcfcb17fcdc055e5edf2a4f4042 (diff)
x86, vmlinux.lds: unify header/footer
Merge everything except PHDRS and SECTIONS into vmlinux.lds.S. [ Impact: cleanup ] Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Tim Abbott <tabbott@MIT.EDU> Cc: Linus Torvalds <torvalds@linux-foundation.org> LKML-Reference: <1240991249-27117-2-git-send-email-sam@ravnborg.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/vmlinux.lds.S77
-rw-r--r--arch/x86/kernel/vmlinux_32.lds.S37
-rw-r--r--arch/x86/kernel/vmlinux_64.lds.S42
3 files changed, 77 insertions, 79 deletions
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 849ee611f013..d113642c1345 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -1,5 +1,82 @@
1/*
2 * ld script for the x86 kernel
3 *
4 * Historic 32-bit version written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
5 *
6 * Modernisation and unification done by Sam Ravnborg <sam@ravnborg.org>
7 *
8 *
9 * Don't define absolute symbols until and unless you know that symbol
10 * value is should remain constant even if kernel image is relocated
11 * at run time. Absolute symbols are not relocated. If symbol value should
12 * change if kernel is relocated, make the symbol section relative and
13 * put it inside the section definition.
14 */
15
16#ifdef CONFIG_X86_32
17#define LOAD_OFFSET __PAGE_OFFSET
18#else
19#define LOAD_OFFSET __START_KERNEL_map
20#endif
21
22#include <asm-generic/vmlinux.lds.h>
23#include <asm/asm-offsets.h>
24#include <asm/thread_info.h>
25#include <asm/page_types.h>
26#include <asm/cache.h>
27#include <asm/boot.h>
28
29#undef i386 /* in case the preprocessor is a 32bit one */
30
31OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT)
32
33#ifdef CONFIG_X86_32
34OUTPUT_ARCH(i386)
35ENTRY(phys_startup_32)
36jiffies = jiffies_64;
37#else
38OUTPUT_ARCH(i386:x86-64)
39ENTRY(phys_startup_64)
40jiffies_64 = jiffies;
41#endif
42
43
1#ifdef CONFIG_X86_32 44#ifdef CONFIG_X86_32
2# include "vmlinux_32.lds.S" 45# include "vmlinux_32.lds.S"
3#else 46#else
4# include "vmlinux_64.lds.S" 47# include "vmlinux_64.lds.S"
5#endif 48#endif
49
50
51#ifdef CONFIG_X86_32
52ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
53 "kernel image bigger than KERNEL_IMAGE_SIZE")
54#else
55/*
56 * Per-cpu symbols which need to be offset from __per_cpu_load
57 * for the boot processor.
58 */
59#define INIT_PER_CPU(x) init_per_cpu__##x = per_cpu__##x + __per_cpu_load
60INIT_PER_CPU(gdt_page);
61INIT_PER_CPU(irq_stack_union);
62
63/*
64 * Build-time check on the image size:
65 */
66ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
67 "kernel image bigger than KERNEL_IMAGE_SIZE")
68
69#ifdef CONFIG_SMP
70ASSERT((per_cpu__irq_stack_union == 0),
71 "irq_stack_union is not at start of per-cpu area");
72#endif
73
74#endif /* CONFIG_X86_32 */
75
76#ifdef CONFIG_KEXEC
77#include <asm/kexec.h>
78
79ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
80 "kexec control code size is too big")
81#endif
82
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index fffa45a1036f..4c985fcd9ab4 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -1,26 +1,3 @@
1/* ld script to make i386 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3 *
4 * Don't define absolute symbols until and unless you know that symbol
5 * value is should remain constant even if kernel image is relocated
6 * at run time. Absolute symbols are not relocated. If symbol value should
7 * change if kernel is relocated, make the symbol section relative and
8 * put it inside the section definition.
9 */
10
11#define LOAD_OFFSET __PAGE_OFFSET
12
13#include <asm-generic/vmlinux.lds.h>
14#include <asm/thread_info.h>
15#include <asm/page_types.h>
16#include <asm/cache.h>
17#include <asm/boot.h>
18
19OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
20OUTPUT_ARCH(i386)
21ENTRY(phys_startup_32)
22jiffies = jiffies_64;
23
24PHDRS { 1PHDRS {
25 text PT_LOAD FLAGS(5); /* R_E */ 2 text PT_LOAD FLAGS(5); /* R_E */
26 data PT_LOAD FLAGS(7); /* RWE */ 3 data PT_LOAD FLAGS(7); /* RWE */
@@ -237,17 +214,3 @@ SECTIONS
237 STABS_DEBUG 214 STABS_DEBUG
238 DWARF_DEBUG 215 DWARF_DEBUG
239} 216}
240
241/*
242 * Build-time check on the image size:
243 */
244ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
245 "kernel image bigger than KERNEL_IMAGE_SIZE")
246
247#ifdef CONFIG_KEXEC
248/* Link time checks */
249#include <asm/kexec.h>
250
251ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
252 "kexec control code size is too big")
253#endif
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index 6d5a5b05eaa2..7f1cc3d5fef2 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -1,19 +1,3 @@
1/* ld script to make x86-64 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3 */
4
5#define LOAD_OFFSET __START_KERNEL_map
6
7#include <asm-generic/vmlinux.lds.h>
8#include <asm/asm-offsets.h>
9#include <asm/page_types.h>
10
11#undef i386 /* in case the preprocessor is a 32bit one */
12
13OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
14OUTPUT_ARCH(i386:x86-64)
15ENTRY(phys_startup_64)
16jiffies_64 = jiffies;
17PHDRS { 1PHDRS {
18 text PT_LOAD FLAGS(5); /* R_E */ 2 text PT_LOAD FLAGS(5); /* R_E */
19 data PT_LOAD FLAGS(7); /* RWE */ 3 data PT_LOAD FLAGS(7); /* RWE */
@@ -308,29 +292,3 @@ SECTIONS
308 STABS_DEBUG 292 STABS_DEBUG
309 DWARF_DEBUG 293 DWARF_DEBUG
310} 294}
311
312/*
313 * Per-cpu symbols which need to be offset from __per_cpu_load
314 * for the boot processor.
315 */
316#define INIT_PER_CPU(x) init_per_cpu__##x = per_cpu__##x + __per_cpu_load
317INIT_PER_CPU(gdt_page);
318INIT_PER_CPU(irq_stack_union);
319
320/*
321 * Build-time check on the image size:
322 */
323ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
324 "kernel image bigger than KERNEL_IMAGE_SIZE")
325
326#ifdef CONFIG_SMP
327ASSERT((per_cpu__irq_stack_union == 0),
328 "irq_stack_union is not at start of per-cpu area");
329#endif
330
331#ifdef CONFIG_KEXEC
332#include <asm/kexec.h>
333
334ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
335 "kexec control code size is too big")
336#endif