1 hostprogs-y := vdsomunge
3 obj-vdso := vgettimeofday.o datapage.o
6 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.so.raw vdso.lds
7 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
9 ccflags-y := -shared -fPIC -fno-common -fno-builtin -fno-stack-protector
10 ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 -DDISABLE_BRANCH_PROFILING
11 ccflags-y += -Wl,--no-undefined $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
15 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
17 CFLAGS_REMOVE_vdso.o = -pg
19 # Force -O2 to avoid libgcc dependencies
20 CFLAGS_REMOVE_vgettimeofday.o = -pg -Os
21 CFLAGS_vgettimeofday.o = -O2
23 # Disable gcov profiling for VDSO code
27 $(obj)/vdso.o : $(obj)/vdso.so
29 # Link rule for the .so file
30 $(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE
31 $(call if_changed,vdsold)
33 $(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE
34 $(call if_changed,vdsomunge)
36 # Strip rule for the .so file
37 $(obj)/%.so: OBJCOPYFLAGS := -S
38 $(obj)/%.so: $(obj)/%.so.dbg FORCE
39 $(call if_changed,objcopy)
41 # Actual build commands
42 quiet_cmd_vdsold = VDSO $@
43 cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \
44 $(call cc-ldoption, -Wl$(comma)--build-id) \
45 -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \
46 -Wl,-z,common-page-size=4096 -o $@
48 quiet_cmd_vdsomunge = MUNGE $@
49 cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
52 # Install the unstripped copy of vdso.so.dbg. If our toolchain
53 # supports build-id, install .build-id links as well.
55 # Cribbed from arch/x86/vdso/Makefile.
57 quiet_cmd_vdso_install = INSTALL $<
58 define cmd_vdso_install
59 cp $< "$(MODLIB)/vdso/vdso.so"; \
60 if readelf -n $< | grep -q 'Build ID'; then \
61 buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \
62 first=`echo $$buildid | cut -b-2`; \
63 last=`echo $$buildid | cut -b3-`; \
64 mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \
65 ln -sf "../../vdso.so" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \
70 @mkdir -p $(MODLIB)/vdso
73 vdso_install: $(obj)/vdso.so.dbg $(MODLIB)/vdso FORCE
74 $(call cmd,vdso_install)