e4cbc2145bab167c2b257de5dfdd28690279a7dc
[pandora-kernel.git] / arch / x86 / vdso / vdso-layout.lds.S
1 #include <asm/vdso.h>
2
3 /*
4  * Linker script for vDSO.  This is an ELF shared object prelinked to
5  * its virtual address, and with only one read-only segment.
6  * This script controls its layout.
7  */
8
9 #if defined(BUILD_VDSO64)
10 # define SHDR_SIZE 64
11 #elif defined(BUILD_VDSO32) || defined(BUILD_VDSOX32)
12 # define SHDR_SIZE 40
13 #else
14 # error unknown VDSO target
15 #endif
16
17 #define NUM_FAKE_SHDRS 16
18
19 SECTIONS
20 {
21         . = SIZEOF_HEADERS;
22
23         .hash           : { *(.hash) }                  :text
24         .gnu.hash       : { *(.gnu.hash) }
25         .dynsym         : { *(.dynsym) }
26         .dynstr         : { *(.dynstr) }
27         .gnu.version    : { *(.gnu.version) }
28         .gnu.version_d  : { *(.gnu.version_d) }
29         .gnu.version_r  : { *(.gnu.version_r) }
30
31         .note           : { *(.note.*) }                :text   :note
32
33         .eh_frame_hdr   : { *(.eh_frame_hdr) }          :text   :eh_frame_hdr
34         .eh_frame       : { KEEP (*(.eh_frame)) }       :text
35
36         .dynamic        : { *(.dynamic) }               :text   :dynamic
37
38         .rodata         : {
39                 *(.rodata*)
40
41                 /*
42                  * Ideally this would live in a C file, but that won't
43                  * work cleanly for x32 until we start building the x32
44                  * C code using an x32 toolchain.
45                  */
46                 VDSO_FAKE_SECTION_TABLE_START = .;
47                 . = . + NUM_FAKE_SHDRS * SHDR_SIZE;
48                 VDSO_FAKE_SECTION_TABLE_END = .;
49         }                                               :text
50
51         .fake_shstrtab  : { *(.fake_shstrtab) }         :text
52
53         .data           : {
54                 *(.data*)
55                 *(.sdata*)
56                 *(.got.plt) *(.got)
57                 *(.gnu.linkonce.d.*)
58                 *(.bss*)
59                 *(.dynbss*)
60                 *(.gnu.linkonce.b.*)
61         }
62
63         .altinstructions        : { *(.altinstructions) }
64         .altinstr_replacement   : { *(.altinstr_replacement) }
65
66         /*
67          * Align the actual code well away from the non-instruction data.
68          * This is the best thing for the I-cache.
69          */
70         . = ALIGN(0x100);
71
72         .text           : { *(.text*) }                 :text   =0x90909090,
73
74         /*
75          * The remainder of the vDSO consists of special pages that are
76          * shared between the kernel and userspace.  It needs to be at the
77          * end so that it doesn't overlap the mapping of the actual
78          * vDSO image.
79          */
80
81         . = ALIGN(PAGE_SIZE);
82         vvar_page = .;
83
84         /* Place all vvars at the offsets in asm/vvar.h. */
85 #define EMIT_VVAR(name, offset) vvar_ ## name = vvar_page + offset;
86 #define __VVAR_KERNEL_LDS
87 #include <asm/vvar.h>
88 #undef __VVAR_KERNEL_LDS
89 #undef EMIT_VVAR
90
91         . = vvar_page + PAGE_SIZE;
92
93         hpet_page = .;
94         . = . + PAGE_SIZE;
95
96         . = ALIGN(PAGE_SIZE);
97         end_mapping = .;
98
99         /DISCARD/ : {
100                 *(.discard)
101                 *(.discard.*)
102                 *(__bug_table)
103         }
104 }
105
106 /*
107  * Very old versions of ld do not recognize this name token; use the constant.
108  */
109 #define PT_GNU_EH_FRAME 0x6474e550
110
111 /*
112  * We must supply the ELF program headers explicitly to get just one
113  * PT_LOAD segment, and set the flags explicitly to make segments read-only.
114  */
115 PHDRS
116 {
117         text            PT_LOAD         FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
118         dynamic         PT_DYNAMIC      FLAGS(4);               /* PF_R */
119         note            PT_NOTE         FLAGS(4);               /* PF_R */
120         eh_frame_hdr    PT_GNU_EH_FRAME;
121 }