aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/vdso/vdso-layout.lds.S64
-rw-r--r--arch/x86/vdso/vdso.lds.S102
-rw-r--r--arch/x86/vdso/voffset.h1
3 files changed, 89 insertions, 78 deletions
diff --git a/arch/x86/vdso/vdso-layout.lds.S b/arch/x86/vdso/vdso-layout.lds.S
new file mode 100644
index 000000000000..634a2cf62046
--- /dev/null
+++ b/arch/x86/vdso/vdso-layout.lds.S
@@ -0,0 +1,64 @@
1/*
2 * Linker script for vDSO. This is an ELF shared object prelinked to
3 * its virtual address, and with only one read-only segment.
4 * This script controls its layout.
5 */
6
7SECTIONS
8{
9 . = VDSO_PRELINK + SIZEOF_HEADERS;
10
11 .hash : { *(.hash) } :text
12 .gnu.hash : { *(.gnu.hash) }
13 .dynsym : { *(.dynsym) }
14 .dynstr : { *(.dynstr) }
15 .gnu.version : { *(.gnu.version) }
16 .gnu.version_d : { *(.gnu.version_d) }
17 .gnu.version_r : { *(.gnu.version_r) }
18
19 .note : { *(.note.*) } :text :note
20
21 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
22 .eh_frame : { KEEP (*(.eh_frame)) } :text
23
24 .dynamic : { *(.dynamic) } :text :dynamic
25
26 .rodata : { *(.rodata*) } :text
27 .data : {
28 *(.data*)
29 *(.sdata*)
30 *(.got.plt) *(.got)
31 *(.gnu.linkonce.d.*)
32 *(.bss*)
33 *(.dynbss*)
34 *(.gnu.linkonce.b.*)
35 }
36
37 .altinstructions : { *(.altinstructions) }
38 .altinstr_replacement : { *(.altinstr_replacement) }
39
40 /*
41 * Align the actual code well away from the non-instruction data.
42 * This is the best thing for the I-cache.
43 */
44 . = ALIGN(0x100);
45
46 .text : { *(.text*) } :text =0x90909090
47}
48
49/*
50 * Very old versions of ld do not recognize this name token; use the constant.
51 */
52#define PT_GNU_EH_FRAME 0x6474e550
53
54/*
55 * We must supply the ELF program headers explicitly to get just one
56 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
57 */
58PHDRS
59{
60 text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
61 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
62 note PT_NOTE FLAGS(4); /* PF_R */
63 eh_frame_hdr PT_GNU_EH_FRAME;
64}
diff --git a/arch/x86/vdso/vdso.lds.S b/arch/x86/vdso/vdso.lds.S
index d40d0e906190..4e5dd3b4de7f 100644
--- a/arch/x86/vdso/vdso.lds.S
+++ b/arch/x86/vdso/vdso.lds.S
@@ -1,89 +1,37 @@
1/* 1/*
2 * Linker script for vsyscall DSO. The vsyscall page is an ELF shared 2 * Linker script for 64-bit vDSO.
3 * object prelinked to its virtual address, and with only one read-only 3 * We #include the file to define the layout details.
4 * segment (that fits in one page). This script controls its layout. 4 * Here we only choose the prelinked virtual address.
5 *
6 * This file defines the version script giving the user-exported symbols in
7 * the DSO. We can define local symbols here called VDSO* to make their
8 * values visible using the asm-x86/vdso.h macros from the kernel proper.
5 */ 9 */
6#include <asm/asm-offsets.h>
7#include "voffset.h"
8 10
9#define VDSO_PRELINK 0xffffffffff700000 11#define VDSO_PRELINK 0xffffffffff700000
12#include "vdso-layout.lds.S"
10 13
11/* 14/*
12 * Symbols we define here called VDSO* get their values into vdso-syms.lds 15 * This controls what userland symbols we export from the vDSO.
13 * and become visible to the kernel itself.
14 */ 16 */
15VDSO64_PRELINK = VDSO_PRELINK; 17VERSION {
16 18 LINUX_2.6 {
17#define VEXTERN(x) VDSO64_ ## x = vdso_ ## x; 19 global:
18#include "vextern.h" 20 clock_gettime;
19#undef VEXTERN 21 __vdso_clock_gettime;
20 22 gettimeofday;
21SECTIONS 23 __vdso_gettimeofday;
22{ 24 getcpu;
23 . = VDSO_PRELINK + SIZEOF_HEADERS; 25 __vdso_getcpu;
24 26 local: *;
25 .hash : { *(.hash) } :text 27 };
26 .gnu.hash : { *(.gnu.hash) }
27 .dynsym : { *(.dynsym) }
28 .dynstr : { *(.dynstr) }
29 .gnu.version : { *(.gnu.version) }
30 .gnu.version_d : { *(.gnu.version_d) }
31 .gnu.version_r : { *(.gnu.version_r) }
32
33 /* This linker script is used both with -r and with -shared.
34 For the layouts to match, we need to skip more than enough
35 space for the dynamic symbol table et al. If this amount
36 is insufficient, ld -shared will barf. Just increase it here. */
37 . = VDSO_PRELINK + VDSO_TEXT_OFFSET;
38
39 .text : { *(.text*) } :text
40 .rodata : { *(.rodata*) } :text
41 .data : {
42 *(.data*)
43 *(.sdata*)
44 *(.bss*)
45 *(.dynbss*)
46 } :text
47
48 .altinstructions : { *(.altinstructions) } :text
49 .altinstr_replacement : { *(.altinstr_replacement) } :text
50
51 .note : { *(.note.*) } :text :note
52 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
53 .eh_frame : { KEEP (*(.eh_frame)) } :text
54 .dynamic : { *(.dynamic) } :text :dynamic
55 .useless : {
56 *(.got.plt) *(.got)
57 *(.gnu.linkonce.d.*)
58 *(.gnu.linkonce.b.*)
59 } :text
60} 28}
61 29
62/* 30VDSO64_PRELINK = VDSO_PRELINK;
63 * We must supply the ELF program headers explicitly to get just one
64 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
65 */
66PHDRS
67{
68 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
69 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
70 note PT_NOTE FLAGS(4); /* PF_R */
71 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
72}
73 31
74/* 32/*
75 * This controls what symbols we export from the DSO. 33 * Define VDSO64_x for each VEXTERN(x), for use via VDSO64_SYMBOL.
76 */ 34 */
77VERSION 35#define VEXTERN(x) VDSO64_ ## x = vdso_ ## x;
78{ 36#include "vextern.h"
79 LINUX_2.6 { 37#undef VEXTERN
80 global:
81 clock_gettime;
82 __vdso_clock_gettime;
83 gettimeofday;
84 __vdso_gettimeofday;
85 getcpu;
86 __vdso_getcpu;
87 local: *;
88 };
89}
diff --git a/arch/x86/vdso/voffset.h b/arch/x86/vdso/voffset.h
deleted file mode 100644
index 4af67c79085f..000000000000
--- a/arch/x86/vdso/voffset.h
+++ /dev/null
@@ -1 +0,0 @@
1#define VDSO_TEXT_OFFSET 0x600