Linux 4.18.10
[linux/fpc-iii.git] / arch / x86 / um / vdso / Makefile
blobb2d6967262b2ee328aefd28b29a8694b100c1214
1 # SPDX-License-Identifier: GPL-2.0
3 # Building vDSO images for x86.
6 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
7 KCOV_INSTRUMENT := n
9 VDSO64-y := y
11 vdso-install-$(VDSO64-y) += vdso.so
14 # files to link into the vdso
15 vobjs-y := vdso-note.o um_vdso.o
17 # files to link into kernel
18 obj-$(VDSO64-y) += vdso.o vma.o
20 vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
22 $(obj)/vdso.o: $(obj)/vdso.so
24 targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
26 CPPFLAGS_vdso.lds += -P -C
28 VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
29 -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
31 $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
33 $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
34 $(call if_changed,vdso)
36 $(obj)/%.so: OBJCOPYFLAGS := -S
37 $(obj)/%.so: $(obj)/%.so.dbg FORCE
38 $(call if_changed,objcopy)
41 # Don't omit frame pointers for ease of userspace debugging, but do
42 # optimize sibling calls.
44 CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
45 $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \
46 -fno-omit-frame-pointer -foptimize-sibling-calls
48 $(vobjs): KBUILD_CFLAGS += $(CFL)
51 # vDSO code runs in userspace and -pg doesn't help with profiling anyway.
53 CFLAGS_REMOVE_vdso-note.o = -pg -fprofile-arcs -ftest-coverage
54 CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage
56 targets += vdso-syms.lds
57 extra-$(VDSO64-y) += vdso-syms.lds
60 # Match symbols in the DSO that look like VDSO*; produce a file of constants.
62 sed-vdsosym := -e 's/^00*/0/' \
63 -e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p'
64 quiet_cmd_vdsosym = VDSOSYM $@
65 define cmd_vdsosym
66 $(NM) $< | LC_ALL=C sed -n $(sed-vdsosym) | LC_ALL=C sort > $@
67 endef
69 $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
70 $(call if_changed,vdsosym)
73 # The DSO images are built using a special linker script.
75 quiet_cmd_vdso = VDSO $@
76 cmd_vdso = $(CC) -nostdlib -o $@ \
77 $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
78 -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
79 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
81 VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
82 GCOV_PROFILE := n
85 # Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
87 quiet_cmd_vdso_install = INSTALL $@
88 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
89 $(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE
90 @mkdir -p $(MODLIB)/vdso
91 $(call cmd,vdso_install)
93 PHONY += vdso_install $(vdso-install-y)
94 vdso_install: $(vdso-install-y)