2 # Building a vDSO image for AArch64.
4 # Author: Will Deacon <will.deacon@arm.com>
5 # Heavily based on the vDSO Makefiles for other archs.
8 obj-vdso := note.o datapage.o sigreturn.o gettimeofday.o
11 targets := $(obj-vdso) vdso.so vdso.so.dbg
12 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
14 ccflags-y := -shared -fno-common -fno-builtin -nostdlib -fPIC -Wl,-shared -g \
15 -Wl,-soname=linux-vdso.so.1 -Wl,--hash-style=sysv
17 # Disable gcov profiling for VDSO code
23 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
26 $(obj)/vdso.o : $(obj)/vdso.so
28 # Link rule for the .so file, .lds has to be first
29 $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
30 $(call if_changed,vdsold)
33 # Strip rule for the .so file
34 $(obj)/%.so: OBJCOPYFLAGS := -S
35 $(obj)/%.so: $(obj)/%.so.dbg FORCE
36 $(call if_changed,objcopy)
38 # Generate VDSO offsets using helper script
39 gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
40 quiet_cmd_vdsosym = VDSOSYM $@
41 cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
43 include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
44 $(call if_changed,vdsosym)
48 # Assembly rules for the .S files
50 sigreturn.o : sigreturn.S
51 $(call if_changed_dep,vdsoas)
54 $(call if_changed_dep,vdsoas)
56 datapage.o : datapage.S
57 $(call if_changed_dep,vdsoas)
59 gettimeofday.o : gettimeofday.c FORCE
60 $(call if_changed_dep,vdsocc)
62 # Actual build commands
63 quiet_cmd_vdsold = VDSOL $@
64 cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $(real-prereqs) -o $@
65 quiet_cmd_vdsoas = VDSOA $@
66 cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
67 quiet_cmd_vdsocc = VDSOA $@
68 cmd_vdsocc = $(CC) $(c_flags) -c -o $@ $<
70 # Install commands for the unstripped file
71 quiet_cmd_vdso_install = INSTALL $@
72 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
74 vdso.so: $(obj)/vdso.so.dbg
75 @mkdir -p $(MODLIB)/vdso
76 $(call cmd,vdso_install)