GNU Linux-libre 4.19.245-gnu1
[releases.git] / arch / nds32 / kernel / vdso / Makefile
1 #
2 # Building a vDSO image for AArch64.
3 #
4 # Author: Will Deacon <will.deacon@arm.com>
5 # Heavily based on the vDSO Makefiles for other archs.
6 #
7
8 obj-vdso := note.o datapage.o sigreturn.o gettimeofday.o
9
10 # Build rules
11 targets := $(obj-vdso) vdso.so vdso.so.dbg
12 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
13
14 ccflags-y := -shared -fno-common -fno-builtin
15 ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \
16                 $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
17 ccflags-y += -fPIC -Wl,-shared -g
18
19 # Disable gcov profiling for VDSO code
20 GCOV_PROFILE := n
21
22
23 obj-y += vdso.o
24 extra-y += vdso.lds
25 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
26
27 # Force dependency
28 $(obj)/vdso.o : $(obj)/vdso.so
29
30 # Link rule for the .so file, .lds has to be first
31 $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso)
32         $(call if_changed,vdsold)
33
34
35 # Strip rule for the .so file
36 $(obj)/%.so: OBJCOPYFLAGS := -S
37 $(obj)/%.so: $(obj)/%.so.dbg FORCE
38         $(call if_changed,objcopy)
39
40 # Generate VDSO offsets using helper script
41 gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
42 quiet_cmd_vdsosym = VDSOSYM $@
43 define cmd_vdsosym
44         $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
45 endef
46
47 include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
48         $(call if_changed,vdsosym)
49
50
51
52 # Assembly rules for the .S files
53
54 sigreturn.o : sigreturn.S
55         $(call if_changed_dep,vdsoas)
56
57 note.o : note.S
58         $(call if_changed_dep,vdsoas)
59
60 datapage.o : datapage.S
61         $(call if_changed_dep,vdsoas)
62
63 gettimeofday.o : gettimeofday.c FORCE
64         $(call if_changed_dep,vdsocc)
65
66 # Actual build commands
67 quiet_cmd_vdsold = VDSOL   $@
68       cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@
69 quiet_cmd_vdsoas = VDSOA   $@
70       cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
71 quiet_cmd_vdsocc = VDSOA   $@
72       cmd_vdsocc = $(CC) $(c_flags) -c -o $@ $<
73
74 # Install commands for the unstripped file
75 quiet_cmd_vdso_install = INSTALL $@
76       cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
77
78 vdso.so: $(obj)/vdso.so.dbg
79         @mkdir -p $(MODLIB)/vdso
80         $(call cmd,vdso_install)
81
82 vdso_install: vdso.so