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