Merge remote-tracking branch 'lsk/v3.10/topic/gator' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / kernel / vdso / Makefile
1 #
2 # Building a vDSO image for AArch64.
3 #
4 # Author: Will Deacon <will.deacon@arm.com>
5 # Heavily based on the vDSO Makefiles for other archs.
6 #
7
8 obj-vdso := gettimeofday.o note.o sigreturn.o
9
10 # Build rules
11 targets := $(obj-vdso) vdso.so vdso.so.dbg
12 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
13
14 ccflags-y := -shared -fno-common -fno-builtin
15 ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \
16                 $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
17
18 obj-y += vdso.o
19 extra-y += vdso.lds vdso-offsets.h
20 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
21
22 # Force dependency (incbin is bad)
23 $(obj)/vdso.o : $(obj)/vdso.so
24
25 # Link rule for the .so file, .lds has to be first
26 $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso)
27         $(call if_changed,vdsold)
28
29 # Strip rule for the .so file
30 $(obj)/%.so: OBJCOPYFLAGS := -S
31 $(obj)/%.so: $(obj)/%.so.dbg FORCE
32         $(call if_changed,objcopy)
33
34 # Generate VDSO offsets using helper script
35 gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
36 quiet_cmd_vdsosym = VDSOSYM $@
37 define cmd_vdsosym
38         $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ && \
39         cp $@ include/generated/
40 endef
41
42 $(obj)/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
43         $(call if_changed,vdsosym)
44
45 # Assembly rules for the .S files
46 $(obj-vdso): %.o: %.S
47         $(call if_changed_dep,vdsoas)
48
49 # Actual build commands
50 quiet_cmd_vdsold = VDSOL   $@
51       cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@
52 quiet_cmd_vdsoas = VDSOA   $@
53       cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
54
55 # Install commands for the unstripped file
56 quiet_cmd_vdso_install = INSTALL $@
57       cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
58
59 vdso.so: $(obj)/vdso.so.dbg
60         @mkdir -p $(MODLIB)/vdso
61         $(call cmd,vdso_install)
62
63 vdso_install: vdso.so