Merge tag 'v3.10.86' into linux-linaro-lsk-v3.10
[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 # Workaround for bare-metal (ELF) toolchains that neglect to pass -shared
19 # down to collect2, resulting in silent corruption of the vDSO image.
20 ccflags-y += -Wl,-shared
21
22 obj-y += vdso.o
23 extra-y += vdso.lds vdso-offsets.h
24 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
25
26 # Force dependency (incbin is bad)
27 $(obj)/vdso.o : $(obj)/vdso.so
28
29 # Link rule for the .so file, .lds has to be first
30 $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso)
31         $(call if_changed,vdsold)
32
33 # Strip rule for the .so file
34 $(obj)/%.so: OBJCOPYFLAGS := -S
35 $(obj)/%.so: $(obj)/%.so.dbg FORCE
36         $(call if_changed,objcopy)
37
38 # Generate VDSO offsets using helper script
39 gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
40 quiet_cmd_vdsosym = VDSOSYM $@
41 define cmd_vdsosym
42         $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ && \
43         cp $@ include/generated/
44 endef
45
46 $(obj)/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
47         $(call if_changed,vdsosym)
48
49 # Assembly rules for the .S files
50 $(obj-vdso): %.o: %.S FORCE
51         $(call if_changed_dep,vdsoas)
52
53 # Actual build commands
54 quiet_cmd_vdsold = VDSOL   $@
55       cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@
56 quiet_cmd_vdsoas = VDSOA   $@
57       cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
58
59 # Install commands for the unstripped file
60 quiet_cmd_vdso_install = INSTALL $@
61       cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
62
63 vdso.so: $(obj)/vdso.so.dbg
64         @mkdir -p $(MODLIB)/vdso
65         $(call cmd,vdso_install)
66
67 vdso_install: vdso.so