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 := -fPIC -fno-common -fno-builtin -fno-stack-protector
10 ccflags-y += -DDISABLE_BRANCH_PROFILING
12 VDSO_LDFLAGS := -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1
13 VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
14 VDSO_LDFLAGS += -nostdlib -shared
15 VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
16 VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id)
17 VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd)
19 obj-$(CONFIG_VDSO) += vdso.o
20 extra-$(CONFIG_VDSO) += vdso.lds
21 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
23 CFLAGS_REMOVE_vdso.o = -pg
25 # Force -O2 to avoid libgcc dependencies
26 CFLAGS_REMOVE_vgettimeofday.o = -pg -Os
27 CFLAGS_vgettimeofday.o = -O2
29 # Disable gcov profiling for VDSO code
33 $(obj)/vdso.o : $(obj)/vdso.so
35 # Link rule for the .so file
36 $(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE
37 $(call if_changed,vdsold)
39 $(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE
40 $(call if_changed,vdsomunge)
42 # Strip rule for the .so file
43 $(obj)/%.so: OBJCOPYFLAGS := -S
44 $(obj)/%.so: $(obj)/%.so.dbg FORCE
45 $(call if_changed,objcopy)
47 # Actual build commands
48 quiet_cmd_vdsold = VDSO $@
49 cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \
50 -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
52 quiet_cmd_vdsomunge = MUNGE $@
53 cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
56 # Install the unstripped copy of vdso.so.dbg. If our toolchain
57 # supports build-id, install .build-id links as well.
59 # Cribbed from arch/x86/vdso/Makefile.
61 quiet_cmd_vdso_install = INSTALL $<
62 define cmd_vdso_install
63 cp $< "$(MODLIB)/vdso/vdso.so"; \
64 if readelf -n $< | grep -q 'Build ID'; then \
65 buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \
66 first=`echo $$buildid | cut -b-2`; \
67 last=`echo $$buildid | cut -b3-`; \
68 mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \
69 ln -sf "../../vdso.so" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \
74 @mkdir -p $(MODLIB)/vdso
77 vdso_install: $(obj)/vdso.so.dbg $(MODLIB)/vdso
78 $(call cmd,vdso_install)