diff options
Diffstat (limited to 'arch/x86/vdso/Makefile')
-rw-r--r-- | arch/x86/vdso/Makefile | 78 |
1 files changed, 75 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) | ||