x86: fix build on non-C locales.
[deliverable/linux.git] / arch / x86 / vdso / Makefile
CommitLineData
2aae950b 1#
0249c9c1 2# Building vDSO images for x86.
2aae950b
AK
3#
4
0249c9c1
RM
5VDSO64-$(CONFIG_X86_64) := y
6VDSO32-$(CONFIG_X86_32) := y
7VDSO32-$(CONFIG_COMPAT) := y
8
9vdso-install-$(VDSO64-y) += vdso.so
2c158269 10vdso-install-$(VDSO32-y) += $(vdso32-images)
0249c9c1
RM
11
12
2aae950b 13# files to link into the vdso
7f3646aa 14vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
2aae950b
AK
15
16# files to link into kernel
6c3652ef 17obj-$(VDSO64-y) += vma.o vdso.o
af65d648 18obj-$(VDSO32-y) += vdso32.o vdso32-setup.o
2aae950b
AK
19
20vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
21
22$(obj)/vdso.o: $(obj)/vdso.so
23
2b9c97e1 24targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
2aae950b 25
d746d647 26export CPPFLAGS_vdso.lds += -P -C
2aae950b 27
16e48e7e
RM
28VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \
29 -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
2aae950b
AK
30
31$(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
32
f79eb83b 33$(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
16e48e7e 34 $(call if_changed,vdso)
2aae950b 35
f79eb83b
RM
36$(obj)/%.so: OBJCOPYFLAGS := -S
37$(obj)/%.so: $(obj)/%.so.dbg FORCE
38 $(call if_changed,objcopy)
39
037e20a3 40CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64
2aae950b 41
16e48e7e 42$(vobjs): KBUILD_CFLAGS = $(CFL)
2aae950b 43
5b930493 44targets += vdso-syms.lds
6c3652ef 45obj-$(VDSO64-y) += vdso-syms.lds
5b930493
RM
46
47#
48# Match symbols in the DSO that look like VDSO*; produce a file of constants.
49#
50sed-vdsosym := -e 's/^00*/0/' \
03994f01 51 -e 's/^\([[:xdigit:]]*\) . \(VDSO[[:alnum:]_]*\)$$/\2 = 0x\1;/p'
5b930493
RM
52quiet_cmd_vdsosym = VDSOSYM $@
53 cmd_vdsosym = $(NM) $< | sed -n $(sed-vdsosym) | LC_ALL=C sort > $@
54
55$(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
56 $(call if_changed,vdsosym)
57
0249c9c1
RM
58#
59# Build multiple 32-bit vDSO images to choose from at boot time.
60#
6c3652ef 61obj-$(VDSO32-y) += vdso32-syms.lds
0249c9c1 62vdso32.so-$(CONFIG_X86_32) += int80
00f8b1bc 63vdso32.so-$(CONFIG_COMPAT) += syscall
0249c9c1
RM
64vdso32.so-$(VDSO32-y) += sysenter
65
2c158269
RM
66vdso32-images = $(vdso32.so-y:%=vdso32-%.so)
67
0249c9c1
RM
68CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
69VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1
70
71# This makes sure the $(obj) subdirectory exists even though vdso32/
72# is not a kbuild sub-make subdirectory.
73override obj-dirs = $(dir $(obj)) $(obj)/vdso32/
74
75targets += vdso32/vdso32.lds
2c158269 76targets += $(vdso32-images) $(vdso32-images:=.dbg)
0249c9c1
RM
77targets += vdso32/note.o $(vdso32.so-y:%=vdso32/%.o)
78
2c158269 79extra-y += $(vdso32-images)
0249c9c1 80
2c158269 81$(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%)
6c3652ef 82
0249c9c1 83KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS))
2c158269
RM
84$(vdso32-images:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
85$(vdso32-images:%=$(obj)/%.dbg): asflags-$(CONFIG_X86_64) += -m32
0249c9c1 86
2c158269
RM
87$(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \
88 $(obj)/vdso32/vdso32.lds \
89 $(obj)/vdso32/note.o \
90 $(obj)/vdso32/%.o
0249c9c1
RM
91 $(call if_changed,vdso)
92
93# Make vdso32-*-syms.lds from each image, and then make sure they match.
94# The only difference should be that some do not define VDSO32_SYSENTER_RETURN.
95
96targets += vdso32-syms.lds $(vdso32.so-y:%=vdso32-%-syms.lds)
97
98quiet_cmd_vdso32sym = VDSOSYM $@
99define cmd_vdso32sym
100 if LC_ALL=C sort -u $(filter-out FORCE,$^) > $(@D)/.tmp_$(@F) && \
101 $(foreach H,$(filter-out FORCE,$^),\
102 if grep -q VDSO32_SYSENTER_RETURN $H; \
103 then diff -u $(@D)/.tmp_$(@F) $H; \
104 else sed /VDSO32_SYSENTER_RETURN/d $(@D)/.tmp_$(@F) | \
105 diff -u - $H; fi &&) : ;\
106 then mv -f $(@D)/.tmp_$(@F) $@; \
107 else rm -f $(@D)/.tmp_$(@F); exit 1; \
108 fi
109endef
110
111$(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE
112 $(call if_changed,vdso32sym)
113
114#
115# The DSO images are built using a special linker script.
116#
117quiet_cmd_vdso = VDSO $@
118 cmd_vdso = $(CC) -nostdlib -o $@ \
119 $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
120 -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^)
121
122VDSO_LDFLAGS = -fPIC -shared $(call ld-option, -Wl$(comma)--hash-style=sysv)
123
124#
125# Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
126#
f79eb83b
RM
127quiet_cmd_vdso_install = INSTALL $@
128 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
0249c9c1 129$(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE
f79eb83b
RM
130 @mkdir -p $(MODLIB)/vdso
131 $(call cmd,vdso_install)
132
0249c9c1
RM
133PHONY += vdso_install $(vdso-install-y)
134vdso_install: $(vdso-install-y)
d531b4fd
SR
135
136clean-files := vdso32-syscall* vdso32-sysenter* vdso32-int80*
This page took 0.169762 seconds and 5 git commands to generate.