1# Include the generic Makefile to check the built vdso.
2include $(srctree)/lib/vdso/Makefile
3
4KCOV_INSTRUMENT := n
5
6# Disable gcov profiling, ubsan and kasan for VDSO code
7GCOV_PROFILE := n
8UBSAN_SANITIZE := n
9KASAN_SANITIZE := n
10KCSAN_SANITIZE := n
11
12obj-vdso64 = note.o sigtramp.o restart_syscall.o
13obj-cvdso64 = vdso64_generic.o
14
15# Build rules
16
17targets := $(obj-vdso64) $(obj-cvdso64) vdso64.so
18obj-vdso64  := $(addprefix $(obj)/, $(obj-vdso64))
19obj-cvdso64 := $(addprefix $(obj)/, $(obj-cvdso64))
20
21VDSO_CFLAGS_REMOVE := -pg $(CC_FLAGS_FTRACE)
22CFLAGS_REMOVE_vdso64_generic.o = $(VDSO_CFLAGS_REMOVE)
23
24ccflags-y := -shared -fno-common -fno-builtin
25ccflags-y += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
26		$(call ld-option, -Wl$(comma)--hash-style=sysv)
27asflags-y := -D__VDSO64__ -s
28
29KBUILD_AFLAGS += -DBUILD_VDSO
30KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING
31
32VDSO_LIBGCC := $(shell $(CC) -print-libgcc-file-name)
33
34obj-y += vdso64_wrapper.o
35extra-y += vdso64.lds
36CPPFLAGS_vdso64.lds += -P -C -U$(ARCH)
37
38$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so FORCE
39
40# Force dependency (incbin is bad)
41# link rule for the .so file, .lds has to be first
42$(obj)/vdso64.so: $(obj)/vdso64.lds $(obj-vdso64) $(obj-cvdso64) $(VDSO_LIBGCC) FORCE
43	$(call if_changed,vdso64ld)
44
45# assembly rules for the .S files
46$(obj-vdso64): %.o: %.S FORCE
47	$(call if_changed_dep,vdso64as)
48$(obj-cvdso64): %.o: %.c FORCE
49	$(call if_changed_dep,vdso64cc)
50
51# actual build commands
52quiet_cmd_vdso64ld = VDSO64L $@
53      cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter-out FORCE, $^) -o $@
54quiet_cmd_vdso64as = VDSO64A $@
55      cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
56quiet_cmd_vdso64cc = VDSO64C $@
57      cmd_vdso64cc = $(CC) $(c_flags) -c -o $@ $<
58
59# Generate VDSO offsets using helper script
60gen-vdsosym := $(src)/gen_vdso_offsets.sh
61quiet_cmd_vdsosym = VDSOSYM $@
62	cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
63
64include/generated/vdso64-offsets.h: $(obj)/vdso64.so FORCE
65	$(call if_changed,vdsosym)
66