aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/vdso/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/vdso/Makefile')
-rw-r--r--arch/x86/vdso/Makefile90
1 files changed, 32 insertions, 58 deletions
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index c580d1210ffe..895d4b16b7e3 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -24,15 +24,30 @@ vobj64s := $(filter-out $(vobjx32s-compat),$(vobjs-y))
24 24
25# files to link into kernel 25# files to link into kernel
26obj-y += vma.o 26obj-y += vma.o
27obj-$(VDSO64-y) += vdso.o 27
28obj-$(VDSOX32-y) += vdsox32.o 28# vDSO images to build
29obj-$(VDSO32-y) += vdso32.o vdso32-setup.o 29vdso_img-$(VDSO64-y) += 64
30vdso_img-$(VDSOX32-y) += x32
31vdso_img-$(VDSO32-y) += 32-int80
32vdso_img-$(CONFIG_COMPAT) += 32-syscall
33vdso_img-$(VDSO32-y) += 32-sysenter
34
35obj-$(VDSO32-y) += vdso32-setup.o
30 36
31vobjs := $(foreach F,$(vobj64s),$(obj)/$F) 37vobjs := $(foreach F,$(vobj64s),$(obj)/$F)
32 38
33$(obj)/vdso.o: $(obj)/vdso.so 39$(obj)/vdso.o: $(obj)/vdso.so
34 40
35targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) 41targets += vdso.lds $(vobjs-y)
42
43# Build the vDSO image C files and link them in.
44vdso_img_objs := $(vdso_img-y:%=vdso-image-%.o)
45vdso_img_cfiles := $(vdso_img-y:%=vdso-image-%.c)
46vdso_img_sodbg := $(vdso_img-y:%=vdso%.so.dbg)
47obj-y += $(vdso_img_objs)
48targets += $(vdso_img_cfiles)
49targets += $(vdso_img_sodbg)
50.SECONDARY: $(vdso_img-y:%=$(obj)/vdso-image-%.c)
36 51
37export CPPFLAGS_vdso.lds += -P -C 52export CPPFLAGS_vdso.lds += -P -C
38 53
@@ -41,14 +56,18 @@ VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
41 -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 \ 56 -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 \
42 $(DISABLE_LTO) 57 $(DISABLE_LTO)
43 58
44$(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so 59$(obj)/vdso64.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
45
46$(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
47 $(call if_changed,vdso) 60 $(call if_changed,vdso)
48 61
49$(obj)/%.so: OBJCOPYFLAGS := -S 62hostprogs-y += vdso2c
50$(obj)/%.so: $(obj)/%.so.dbg FORCE 63
51 $(call if_changed,objcopy) 64quiet_cmd_vdso2c = VDSO2C $@
65define cmd_vdso2c
66 $(obj)/vdso2c $< $@
67endef
68
69$(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso2c FORCE
70 $(call if_changed,vdso2c)
52 71
53# 72#
54# Don't omit frame pointers for ease of userspace debugging, but do 73# Don't omit frame pointers for ease of userspace debugging, but do
@@ -68,22 +87,6 @@ CFLAGS_REMOVE_vclock_gettime.o = -pg
68CFLAGS_REMOVE_vgetcpu.o = -pg 87CFLAGS_REMOVE_vgetcpu.o = -pg
69CFLAGS_REMOVE_vvar.o = -pg 88CFLAGS_REMOVE_vvar.o = -pg
70 89
71targets += vdso-syms.lds
72obj-$(VDSO64-y) += vdso-syms.lds
73
74#
75# Match symbols in the DSO that look like VDSO*; produce a file of constants.
76#
77sed-vdsosym := -e 's/^00*/0/' \
78 -e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p'
79quiet_cmd_vdsosym = VDSOSYM $@
80define cmd_vdsosym
81 $(NM) $< | LC_ALL=C sed -n $(sed-vdsosym) | LC_ALL=C sort > $@
82endef
83
84$(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
85 $(call if_changed,vdsosym)
86
87# 90#
88# X32 processes use x32 vDSO to access 64bit kernel data. 91# X32 processes use x32 vDSO to access 64bit kernel data.
89# 92#
@@ -94,9 +97,6 @@ $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
94# so that it can reach 64bit address space with 64bit pointers. 97# so that it can reach 64bit address space with 64bit pointers.
95# 98#
96 99
97targets += vdsox32-syms.lds
98obj-$(VDSOX32-y) += vdsox32-syms.lds
99
100CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds) 100CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds)
101VDSO_LDFLAGS_vdsox32.lds = -Wl,-m,elf32_x86_64 \ 101VDSO_LDFLAGS_vdsox32.lds = -Wl,-m,elf32_x86_64 \
102 -Wl,-soname=linux-vdso.so.1 \ 102 -Wl,-soname=linux-vdso.so.1 \
@@ -113,9 +113,7 @@ quiet_cmd_x32 = X32 $@
113$(obj)/%-x32.o: $(obj)/%.o FORCE 113$(obj)/%-x32.o: $(obj)/%.o FORCE
114 $(call if_changed,x32) 114 $(call if_changed,x32)
115 115
116targets += vdsox32.so vdsox32.so.dbg vdsox32.lds $(vobjx32s-y) 116targets += vdsox32.lds $(vobjx32s-y)
117
118$(obj)/vdsox32.o: $(src)/vdsox32.S $(obj)/vdsox32.so
119 117
120$(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE 118$(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE
121 $(call if_changed,vdso) 119 $(call if_changed,vdso)
@@ -123,7 +121,6 @@ $(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE
123# 121#
124# Build multiple 32-bit vDSO images to choose from at boot time. 122# Build multiple 32-bit vDSO images to choose from at boot time.
125# 123#
126obj-$(VDSO32-y) += vdso32-syms.lds
127vdso32.so-$(VDSO32-y) += int80 124vdso32.so-$(VDSO32-y) += int80
128vdso32.so-$(CONFIG_COMPAT) += syscall 125vdso32.so-$(CONFIG_COMPAT) += syscall
129vdso32.so-$(VDSO32-y) += sysenter 126vdso32.so-$(VDSO32-y) += sysenter
@@ -138,10 +135,8 @@ VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf_i386 -Wl,-soname=linux-gate.so.1
138override obj-dirs = $(dir $(obj)) $(obj)/vdso32/ 135override obj-dirs = $(dir $(obj)) $(obj)/vdso32/
139 136
140targets += vdso32/vdso32.lds 137targets += vdso32/vdso32.lds
141targets += $(vdso32-images) $(vdso32-images:=.dbg)
142targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o) 138targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o)
143 139targets += vdso32/vclock_gettime.o
144extra-y += $(vdso32-images)
145 140
146$(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%) 141$(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%)
147 142
@@ -166,27 +161,6 @@ $(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \
166 $(obj)/vdso32/%.o 161 $(obj)/vdso32/%.o
167 $(call if_changed,vdso) 162 $(call if_changed,vdso)
168 163
169# Make vdso32-*-syms.lds from each image, and then make sure they match.
170# The only difference should be that some do not define VDSO32_SYSENTER_RETURN.
171
172targets += vdso32-syms.lds $(vdso32.so-y:%=vdso32-%-syms.lds)
173
174quiet_cmd_vdso32sym = VDSOSYM $@
175define cmd_vdso32sym
176 if LC_ALL=C sort -u $(filter-out FORCE,$^) > $(@D)/.tmp_$(@F) && \
177 $(foreach H,$(filter-out FORCE,$^),\
178 if grep -q VDSO32_SYSENTER_RETURN $H; \
179 then diff -u $(@D)/.tmp_$(@F) $H; \
180 else sed /VDSO32_SYSENTER_RETURN/d $(@D)/.tmp_$(@F) | \
181 diff -u - $H; fi &&) : ;\
182 then mv -f $(@D)/.tmp_$(@F) $@; \
183 else rm -f $(@D)/.tmp_$(@F); exit 1; \
184 fi
185endef
186
187$(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE
188 $(call if_changed,vdso32sym)
189
190# 164#
191# The DSO images are built using a special linker script. 165# The DSO images are built using a special linker script.
192# 166#
@@ -197,7 +171,7 @@ quiet_cmd_vdso = VDSO $@
197 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' 171 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
198 172
199VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \ 173VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
200 $(LTO_CFLAGS) 174 -Wl,-Bsymbolic $(LTO_CFLAGS)
201GCOV_PROFILE := n 175GCOV_PROFILE := n
202 176
203# 177#