treewide: Add SPDX license identifier - Makefile/Kconfig
[linux-2.6-block.git] / arch / nds32 / kernel / vdso / Makefile
1 # SPDX-License-Identifier: GPL-2.0-only
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
9 obj-vdso := note.o datapage.o sigreturn.o gettimeofday.o
10
11 # Build rules
12 targets := $(obj-vdso) vdso.so vdso.so.dbg
13 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
14
15 ccflags-y := -shared -fno-common -fno-builtin -nostdlib -fPIC -Wl,-shared -g \
16         -Wl,-soname=linux-vdso.so.1 -Wl,--hash-style=sysv
17
18 # Disable gcov profiling for VDSO code
19 GCOV_PROFILE := n
20
21
22 obj-y += vdso.o
23 extra-y += vdso.lds
24 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
25
26 # Force dependency
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: $(obj)/vdso.lds $(obj-vdso) FORCE
31         $(call if_changed,vdsold)
32
33
34 # Strip rule for the .so file
35 $(obj)/%.so: OBJCOPYFLAGS := -S
36 $(obj)/%.so: $(obj)/%.so.dbg FORCE
37         $(call if_changed,objcopy)
38
39 # Generate VDSO offsets using helper script
40 gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
41 quiet_cmd_vdsosym = VDSOSYM $@
42       cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
43
44 include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
45         $(call if_changed,vdsosym)
46
47
48
49 # Assembly rules for the .S files
50
51 sigreturn.o : sigreturn.S
52         $(call if_changed_dep,vdsoas)
53
54 note.o : note.S
55         $(call if_changed_dep,vdsoas)
56
57 datapage.o : datapage.S
58         $(call if_changed_dep,vdsoas)
59
60 gettimeofday.o : gettimeofday.c FORCE
61         $(call if_changed_dep,vdsocc)
62
63 # Actual build commands
64 quiet_cmd_vdsold = VDSOL   $@
65       cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $(real-prereqs) -o $@
66 quiet_cmd_vdsoas = VDSOA   $@
67       cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
68 quiet_cmd_vdsocc = VDSOA   $@
69       cmd_vdsocc = $(CC) $(c_flags) -c -o $@ $<
70
71 # Install commands for the unstripped file
72 quiet_cmd_vdso_install = INSTALL $@
73       cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
74
75 vdso.so: $(obj)/vdso.so.dbg
76         @mkdir -p $(MODLIB)/vdso
77         $(call cmd,vdso_install)
78
79 vdso_install: vdso.so