diff options
author | Roland McGrath <roland@redhat.com> | 2008-01-30 07:30:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:42 -0500 |
commit | 0249c9c1e7505c2b020bcc6deaf1e0415de9943e (patch) | |
tree | 1c2baf998881a020d512e52f1fce02678d75876d /arch/x86/vdso | |
parent | 0c2f51a7d2546f65e4198cccd6a56e2a8b857677 (diff) |
x86 vDSO: vdso32 build
This builds the 32-bit vDSO images in the arch/x86/vdso subdirectory.
Nothing uses the images yet, but this paves the way for consolidating
the vDSO build logic all in one place. The new images use a linker
script sharing the layout parts from vdso-layout.lds.S with the 64-bit
vDSO. A new vdso32-syms.lds is generated in the style of vdso-syms.lds.
Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/vdso')
-rw-r--r-- | arch/x86/vdso/Makefile | 78 | ||||
-rw-r--r-- | arch/x86/vdso/vdso32/vdso32.lds.S | 37 |
2 files changed, 112 insertions, 3 deletions
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile index 6a665dd09848..a02e1ca2a1bc 100644 --- a/arch/x86/vdso/Makefile +++ b/arch/x86/vdso/Makefile | |||
@@ -1,7 +1,15 @@ | |||
1 | # | 1 | # |
2 | # x86-64 vDSO. | 2 | # Building vDSO images for x86. |
3 | # | 3 | # |
4 | 4 | ||
5 | VDSO64-$(CONFIG_X86_64) := y | ||
6 | VDSO32-$(CONFIG_X86_32) := y | ||
7 | VDSO32-$(CONFIG_COMPAT) := y | ||
8 | |||
9 | vdso-install-$(VDSO64-y) += vdso.so | ||
10 | vdso-install-$(VDSO32-y) += $(vdso32-y:=.so) | ||
11 | |||
12 | |||
5 | # files to link into the vdso | 13 | # files to link into the vdso |
6 | vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vvar.o | 14 | vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vvar.o |
7 | 15 | ||
@@ -57,10 +65,74 @@ quiet_cmd_vdsosym = VDSOSYM $@ | |||
57 | $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE | 65 | $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE |
58 | $(call if_changed,vdsosym) | 66 | $(call if_changed,vdsosym) |
59 | 67 | ||
68 | # | ||
69 | # Build multiple 32-bit vDSO images to choose from at boot time. | ||
70 | # | ||
71 | vdso32.so-$(CONFIG_X86_32) += int80 | ||
72 | vdso32.so-$(VDSO32-y) += sysenter | ||
73 | |||
74 | CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) | ||
75 | VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1 | ||
76 | |||
77 | # This makes sure the $(obj) subdirectory exists even though vdso32/ | ||
78 | # is not a kbuild sub-make subdirectory. | ||
79 | override obj-dirs = $(dir $(obj)) $(obj)/vdso32/ | ||
80 | |||
81 | targets += vdso32/vdso32.lds | ||
82 | targets += $(vdso32.so-y:%=vdso32-%.so.dbg) $(vdso32.so-y:%=vdso32-%.so) | ||
83 | targets += vdso32/note.o $(vdso32.so-y:%=vdso32/%.o) | ||
84 | |||
85 | extra-y += $(vdso32.so-y:%=vdso32-%.so) | ||
86 | |||
87 | KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) | ||
88 | $(vdso32.so-y:%=$(obj)/vdso32-%.so.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32) | ||
89 | $(vdso32.so-y:%=$(obj)/vdso32-%.so.dbg): asflags-$(CONFIG_X86_64) += -m32 | ||
90 | |||
91 | $(vdso32.so-y:%=$(obj)/vdso32-%.so.dbg): $(obj)/vdso32-%.so.dbg: FORCE \ | ||
92 | $(obj)/vdso32/vdso32.lds \ | ||
93 | $(obj)/vdso32/note.o \ | ||
94 | $(obj)/vdso32/%.o | ||
95 | $(call if_changed,vdso) | ||
96 | |||
97 | # Make vdso32-*-syms.lds from each image, and then make sure they match. | ||
98 | # The only difference should be that some do not define VDSO32_SYSENTER_RETURN. | ||
99 | |||
100 | targets += vdso32-syms.lds $(vdso32.so-y:%=vdso32-%-syms.lds) | ||
101 | |||
102 | quiet_cmd_vdso32sym = VDSOSYM $@ | ||
103 | define cmd_vdso32sym | ||
104 | if LC_ALL=C sort -u $(filter-out FORCE,$^) > $(@D)/.tmp_$(@F) && \ | ||
105 | $(foreach H,$(filter-out FORCE,$^),\ | ||
106 | if grep -q VDSO32_SYSENTER_RETURN $H; \ | ||
107 | then diff -u $(@D)/.tmp_$(@F) $H; \ | ||
108 | else sed /VDSO32_SYSENTER_RETURN/d $(@D)/.tmp_$(@F) | \ | ||
109 | diff -u - $H; fi &&) : ;\ | ||
110 | then mv -f $(@D)/.tmp_$(@F) $@; \ | ||
111 | else rm -f $(@D)/.tmp_$(@F); exit 1; \ | ||
112 | fi | ||
113 | endef | ||
114 | |||
115 | $(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE | ||
116 | $(call if_changed,vdso32sym) | ||
117 | |||
118 | # | ||
119 | # The DSO images are built using a special linker script. | ||
120 | # | ||
121 | quiet_cmd_vdso = VDSO $@ | ||
122 | cmd_vdso = $(CC) -nostdlib -o $@ \ | ||
123 | $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ | ||
124 | -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) | ||
125 | |||
126 | VDSO_LDFLAGS = -fPIC -shared $(call ld-option, -Wl$(comma)--hash-style=sysv) | ||
127 | |||
128 | # | ||
129 | # Install the unstripped copy of vdso*.so listed in $(vdso-install-y). | ||
130 | # | ||
60 | quiet_cmd_vdso_install = INSTALL $@ | 131 | quiet_cmd_vdso_install = INSTALL $@ |
61 | cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ | 132 | cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ |
62 | vdso.so: | 133 | $(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE |
63 | @mkdir -p $(MODLIB)/vdso | 134 | @mkdir -p $(MODLIB)/vdso |
64 | $(call cmd,vdso_install) | 135 | $(call cmd,vdso_install) |
65 | 136 | ||
66 | vdso_install: vdso.so | 137 | PHONY += vdso_install $(vdso-install-y) |
138 | vdso_install: $(vdso-install-y) | ||
diff --git a/arch/x86/vdso/vdso32/vdso32.lds.S b/arch/x86/vdso/vdso32/vdso32.lds.S new file mode 100644 index 000000000000..976124bb5f92 --- /dev/null +++ b/arch/x86/vdso/vdso32/vdso32.lds.S | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Linker script for 32-bit vDSO. | ||
3 | * We #include the file to define the layout details. | ||
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. | ||
9 | */ | ||
10 | |||
11 | #define VDSO_PRELINK 0 | ||
12 | #include "../vdso-layout.lds.S" | ||
13 | |||
14 | /* The ELF entry point can be used to set the AT_SYSINFO value. */ | ||
15 | ENTRY(__kernel_vsyscall); | ||
16 | |||
17 | /* | ||
18 | * This controls what userland symbols we export from the vDSO. | ||
19 | */ | ||
20 | VERSION | ||
21 | { | ||
22 | LINUX_2.5 { | ||
23 | global: | ||
24 | __kernel_vsyscall; | ||
25 | __kernel_sigreturn; | ||
26 | __kernel_rt_sigreturn; | ||
27 | local: *; | ||
28 | }; | ||
29 | } | ||
30 | |||
31 | /* | ||
32 | * Symbols we define here called VDSO* get their values into vdso32-syms.h. | ||
33 | */ | ||
34 | VDSO32_PRELINK = VDSO_PRELINK; | ||
35 | VDSO32_vsyscall = __kernel_vsyscall; | ||
36 | VDSO32_sigreturn = __kernel_sigreturn; | ||
37 | VDSO32_rt_sigreturn = __kernel_rt_sigreturn; | ||