d4abb07af52dbef72da991331845b4438251a60b
[pandora-kernel.git] / arch / x86_64 / kernel / vmlinux.lds.S
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/page.h>
9 #include <linux/config.h>
10
11 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
12 OUTPUT_ARCH(i386:x86-64)
13 ENTRY(phys_startup_64)
14 jiffies_64 = jiffies;
15 SECTIONS
16 {
17   . = __START_KERNEL;
18   phys_startup_64 = startup_64 - LOAD_OFFSET;
19   _text = .;                    /* Text and read-only data */
20   .text :  AT(ADDR(.text) - LOAD_OFFSET) {
21         *(.text)
22         SCHED_TEXT
23         LOCK_TEXT
24         KPROBES_TEXT
25         *(.fixup)
26         *(.gnu.warning)
27         } = 0x9090
28                                 /* out-of-line lock text */
29   .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) }
30
31   _etext = .;                   /* End of text section */
32
33   . = ALIGN(16);                /* Exception table */
34   __start___ex_table = .;
35   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
36   __stop___ex_table = .;
37
38   RODATA
39
40                                 /* Data */
41   .data : AT(ADDR(.data) - LOAD_OFFSET) {
42         *(.data)
43         CONSTRUCTORS
44         }
45
46   _edata = .;                   /* End of data section */
47
48   __bss_start = .;              /* BSS */
49   .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
50         *(.bss.page_aligned)    
51         *(.bss)
52         }
53   __bss_end = .;
54
55   . = ALIGN(PAGE_SIZE);
56   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
57   .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
58         *(.data.cacheline_aligned)
59   }
60   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
61   .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
62         *(.data.read_mostly)
63   }
64
65 #define VSYSCALL_ADDR (-10*1024*1024)
66 #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
67 #define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
68
69 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
70 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
71
72 #define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
73 #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
74
75   . = VSYSCALL_ADDR;
76   .vsyscall_0 :  AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) }
77   __vsyscall_0 = VSYSCALL_VIRT_ADDR;
78
79   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
80   .xtime_lock : AT(VLOAD(.xtime_lock)) { *(.xtime_lock) }
81   xtime_lock = VVIRT(.xtime_lock);
82
83   .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) }
84   vxtime = VVIRT(.vxtime);
85
86   .wall_jiffies : AT(VLOAD(.wall_jiffies)) { *(.wall_jiffies) }
87   wall_jiffies = VVIRT(.wall_jiffies);
88
89   .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) }
90   sys_tz = VVIRT(.sys_tz);
91
92   .sysctl_vsyscall : AT(VLOAD(.sysctl_vsyscall)) { *(.sysctl_vsyscall) }
93   sysctl_vsyscall = VVIRT(.sysctl_vsyscall);
94
95   .xtime : AT(VLOAD(.xtime)) { *(.xtime) }
96   xtime = VVIRT(.xtime);
97
98   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
99   .jiffies : AT(VLOAD(.jiffies)) { *(.jiffies) }
100   jiffies = VVIRT(.jiffies);
101
102   .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) { *(.vsyscall_1) }
103   .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) { *(.vsyscall_2) }
104   .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { *(.vsyscall_3) }
105
106   . = VSYSCALL_VIRT_ADDR + 4096;
107
108 #undef VSYSCALL_ADDR
109 #undef VSYSCALL_PHYS_ADDR
110 #undef VSYSCALL_VIRT_ADDR
111 #undef VLOAD_OFFSET
112 #undef VLOAD
113 #undef VVIRT_OFFSET
114 #undef VVIRT
115
116   . = ALIGN(8192);              /* init_task */
117   .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
118         *(.data.init_task)
119   }
120
121   . = ALIGN(4096);
122   .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
123         *(.data.page_aligned)
124   }
125
126   . = ALIGN(4096);              /* Init code and data */
127   __init_begin = .;
128   .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
129         _sinittext = .;
130         *(.init.text)
131         _einittext = .;
132   }
133   __initdata_begin = .;
134   .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
135   __initdata_end = .;
136   . = ALIGN(16);
137   __setup_start = .;
138   .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
139   __setup_end = .;
140   __initcall_start = .;
141   .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
142         *(.initcall1.init) 
143         *(.initcall2.init) 
144         *(.initcall3.init) 
145         *(.initcall4.init) 
146         *(.initcall5.init) 
147         *(.initcall6.init) 
148         *(.initcall7.init)
149   }
150   __initcall_end = .;
151   __con_initcall_start = .;
152   .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
153         *(.con_initcall.init)
154   }
155   __con_initcall_end = .;
156   SECURITY_INIT
157   . = ALIGN(8);
158   __alt_instructions = .;
159   .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
160         *(.altinstructions)
161   }
162   __alt_instructions_end = .; 
163   .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
164         *(.altinstr_replacement)
165   }
166   /* .exit.text is discard at runtime, not link time, to deal with references
167      from .altinstructions and .eh_frame */
168   .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
169   .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
170   . = ALIGN(4096);
171   __initramfs_start = .;
172   .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
173   __initramfs_end = .;  
174   . = ALIGN(32);
175   __per_cpu_start = .;
176   .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
177   __per_cpu_end = .;
178   . = ALIGN(4096);
179   __init_end = .;
180
181   . = ALIGN(4096);
182   __nosave_begin = .;
183   .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
184   . = ALIGN(4096);
185   __nosave_end = .;
186
187   _end = . ;
188
189   /* Sections to be discarded */
190   /DISCARD/ : {
191         *(.exitcall.exit)
192 #ifndef CONFIG_DEBUG_INFO
193         *(.eh_frame)
194 #endif
195         }
196
197   /* DWARF 2 */
198   .debug_info     0 : { *(.debug_info) }
199   .debug_abbrev   0 : { *(.debug_abbrev) }
200   .debug_line     0 : { *(.debug_line) }
201   .debug_frame    0 : { *(.debug_frame) }
202   .debug_str      0 : { *(.debug_str) }
203   .debug_loc      0 : { *(.debug_loc) }
204   .debug_macinfo  0 : { *(.debug_macinfo) }
205   /* SGI/MIPS DWARF 2 extensions */
206   .debug_weaknames 0 : { *(.debug_weaknames) }
207   .debug_funcnames 0 : { *(.debug_funcnames) }
208   .debug_typenames 0 : { *(.debug_typenames) }
209   .debug_varnames  0 : { *(.debug_varnames) }
210
211
212   .comment 0 : { *(.comment) }
213 }