xref: /linux/arch/arm64/kernel/vdso/Makefile (revision ebf68996de0ab250c5d520eb2291ab65643e9a1e)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Building a vDSO image for AArch64.
4#
5# Author: Will Deacon <will.deacon@arm.com>
6# Heavily based on the vDSO Makefiles for other archs.
7#
8
9obj-vdso := gettimeofday.o note.o sigreturn.o
10
11# Build rules
12targets := $(obj-vdso) vdso.so vdso.so.dbg
13obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
14
15ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \
16		--build-id -n -T
17
18# Disable gcov profiling for VDSO code
19GCOV_PROFILE := n
20
21obj-y += vdso.o
22extra-y += vdso.lds
23CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
24
25# Force dependency (incbin is bad)
26$(obj)/vdso.o : $(obj)/vdso.so
27
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,ld)
31
32# Strip rule for the .so file
33$(obj)/%.so: OBJCOPYFLAGS := -S
34$(obj)/%.so: $(obj)/%.so.dbg FORCE
35	$(call if_changed,objcopy)
36
37# Generate VDSO offsets using helper script
38gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
39quiet_cmd_vdsosym = VDSOSYM $@
40      cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
41
42include/generated/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 FORCE
47	$(call if_changed_dep,vdsoas)
48
49# Actual build commands
50quiet_cmd_vdsoas = VDSOA   $@
51      cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
52
53# Install commands for the unstripped file
54quiet_cmd_vdso_install = INSTALL $@
55      cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
56
57vdso.so: $(obj)/vdso.so.dbg
58	@mkdir -p $(MODLIB)/vdso
59	$(call cmd,vdso_install)
60
61vdso_install: vdso.so
62