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.
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
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
)) -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
57 # The DSO images are built using a special linker script.
59 quiet_cmd_vdso
= VDSO
$@
60 cmd_vdso
= $(CC
) -nostdlib
-o
$@ \
61 $(VDSO_LDFLAGS
) $(VDSO_LDFLAGS_
$(filter %.lds
,$(^F
))) \
62 -Wl
,-T
,$(filter %.lds
,$^
) $(filter %.o
,$^
) && \
63 sh
$(srctree
)/$(src
)/checkundef.sh
'$(NM)' '$@'
65 VDSO_LDFLAGS
= -fPIC
-shared
-Wl
,--hash-style
=sysv
69 # Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
71 quiet_cmd_vdso_install
= INSTALL
$@
72 cmd_vdso_install
= cp
$(obj
)/$@.dbg
$(MODLIB
)/vdso
/$@
73 $(vdso-install-y
): %.so
: $(obj
)/%.so.dbg FORCE
74 @mkdir
-p
$(MODLIB
)/vdso
75 $(call cmd
,vdso_install
)
77 PHONY
+= vdso_install
$(vdso-install-y
)
78 vdso_install
: $(vdso-install-y
)