]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm/vdso/Makefile
Merge remote-tracking branch 'mmc-uh/next'
[karo-tx-linux.git] / arch / arm / vdso / Makefile
1 hostprogs-y := vdsomunge
2
3 obj-vdso := vgettimeofday.o datapage.o
4
5 # Build rules
6 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.so.raw vdso.lds
7 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
8
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)
12
13 obj-y += vdso.o
14 extra-y += vdso.lds
15 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
16
17 CFLAGS_REMOVE_vdso.o = -pg
18
19 # Force -O2 to avoid libgcc dependencies
20 CFLAGS_REMOVE_vgettimeofday.o = -pg -Os
21 CFLAGS_vgettimeofday.o = -O2
22
23 # Disable gcov profiling for VDSO code
24 GCOV_PROFILE := n
25
26 # Force dependency
27 $(obj)/vdso.o : $(obj)/vdso.so
28
29 # Link rule for the .so file
30 $(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE
31         $(call if_changed,vdsold)
32
33 $(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE
34         $(call if_changed,vdsomunge)
35
36 # Strip rule for the .so file
37 $(obj)/%.so: OBJCOPYFLAGS := -S
38 $(obj)/%.so: $(obj)/%.so.dbg FORCE
39         $(call if_changed,objcopy)
40
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 $@
47
48 quiet_cmd_vdsomunge = MUNGE   $@
49       cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
50
51 #
52 # Install the unstripped copy of vdso.so.dbg.  If our toolchain
53 # supports build-id, install .build-id links as well.
54 #
55 # Cribbed from arch/x86/vdso/Makefile.
56 #
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"; \
66         fi
67 endef
68
69 $(MODLIB)/vdso: FORCE
70         @mkdir -p $(MODLIB)/vdso
71
72 PHONY += vdso_install
73 vdso_install: $(obj)/vdso.so.dbg $(MODLIB)/vdso FORCE
74         $(call cmd,vdso_install)