]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/arm64/kernel/vdso/Makefile
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / arch / arm64 / kernel / vdso / Makefile
CommitLineData
b2441318 1# SPDX-License-Identifier: GPL-2.0
9031fefd
WD
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
15ccflags-y := -shared -fno-common -fno-builtin
16ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \
17 $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
18
54309784
AB
19# Disable gcov profiling for VDSO code
20GCOV_PROFILE := n
21
6f1a6ae8
WD
22# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared
23# down to collect2, resulting in silent corruption of the vDSO image.
24ccflags-y += -Wl,-shared
25
9031fefd 26obj-y += vdso.o
a66649da 27extra-y += vdso.lds
9031fefd
WD
28CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
29
30# Force dependency (incbin is bad)
31$(obj)/vdso.o : $(obj)/vdso.so
32
33# Link rule for the .so file, .lds has to be first
34$(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso)
35 $(call if_changed,vdsold)
36
37# Strip rule for the .so file
38$(obj)/%.so: OBJCOPYFLAGS := -S
39$(obj)/%.so: $(obj)/%.so.dbg FORCE
40 $(call if_changed,objcopy)
41
42# Generate VDSO offsets using helper script
43gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
44quiet_cmd_vdsosym = VDSOSYM $@
45define cmd_vdsosym
a66649da 46 $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
9031fefd
WD
47endef
48
a66649da 49include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
9031fefd
WD
50 $(call if_changed,vdsosym)
51
52# Assembly rules for the .S files
1915e2ad 53$(obj-vdso): %.o: %.S FORCE
9031fefd
WD
54 $(call if_changed_dep,vdsoas)
55
56# Actual build commands
ad789ba5 57quiet_cmd_vdsold = VDSOL $@
40507403 58 cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@
ad789ba5 59quiet_cmd_vdsoas = VDSOA $@
9031fefd
WD
60 cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
61
62# Install commands for the unstripped file
63quiet_cmd_vdso_install = INSTALL $@
64 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
65
66vdso.so: $(obj)/vdso.so.dbg
67 @mkdir -p $(MODLIB)/vdso
68 $(call cmd,vdso_install)
69
70vdso_install: vdso.so