2 # Building vDSO images for x86.
7 vdso-install-
$(VDSO64-y
) += vdso.so
10 # files to link into the vdso
11 vobjs-y
:= vdso-note.o um_vdso.o
13 # files to link into kernel
14 obj-
$(VDSO64-y
) += vdso.o vma.o
16 vobjs
:= $(foreach F
,$(vobjs-y
),$(obj
)/$F)
18 $(obj
)/vdso.o
: $(obj
)/vdso.so
20 targets
+= vdso.so vdso.so.dbg vdso.lds
$(vobjs-y
)
22 export CPPFLAGS_vdso.lds
+= -P
-C
24 VDSO_LDFLAGS_vdso.lds
= -m64
-Wl
,-soname
=linux-vdso.so
.1 \
25 -Wl
,-z
,max-page-size
=4096 -Wl
,-z
,common-page-size
=4096
27 $(obj
)/vdso.o
: $(src
)/vdso.S
$(obj
)/vdso.so
29 $(obj
)/vdso.so.dbg
: $(src
)/vdso.lds
$(vobjs
) FORCE
30 $(call if_changed
,vdso
)
32 $(obj
)/%.so
: OBJCOPYFLAGS
:= -S
33 $(obj
)/%.so
: $(obj
)/%.so.dbg FORCE
34 $(call if_changed
,objcopy
)
37 # Don't omit frame pointers for ease of userspace debugging, but do
38 # optimize sibling calls.
40 CFL
:= $(PROFILING
) -mcmodel
=small
-fPIC
-O2
-fasynchronous-unwind-tables
-m64 \
41 $(filter -g
%,$(KBUILD_CFLAGS
)) $(call cc-option
, -fno-stack-protector
) \
42 -fno-omit-frame-pointer
-foptimize-sibling-calls
44 $(vobjs
): KBUILD_CFLAGS
+= $(CFL
)
47 # vDSO code runs in userspace and -pg doesn't help with profiling anyway.
49 CFLAGS_REMOVE_vdso-note.o
= -pg
-fprofile-arcs
-ftest-coverage
50 CFLAGS_REMOVE_um_vdso.o
= -pg
-fprofile-arcs
-ftest-coverage
52 targets
+= vdso-syms.lds
53 obj-
$(VDSO64-y
) += vdso-syms.lds
56 # Match symbols in the DSO that look like VDSO*; produce a file of constants.
58 sed-vdsosym
:= -e
's/^00*/0/' \
59 -e
's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p'
60 quiet_cmd_vdsosym
= VDSOSYM
$@
62 $(NM
) $< | LC_ALL
=C sed
-n
$(sed-vdsosym
) | LC_ALL
=C
sort > $@
65 $(obj
)/%-syms.lds
: $(obj
)/%.so.dbg FORCE
66 $(call if_changed
,vdsosym
)
69 # The DSO images are built using a special linker script.
71 quiet_cmd_vdso
= VDSO
$@
72 cmd_vdso
= $(CC
) -nostdlib
-o
$@ \
73 $(VDSO_LDFLAGS
) $(VDSO_LDFLAGS_
$(filter %.lds
,$(^F
))) \
74 -Wl
,-T
,$(filter %.lds
,$^
) $(filter %.o
,$^
) && \
75 sh
$(srctree
)/$(src
)/checkundef.sh
'$(NM)' '$@'
77 VDSO_LDFLAGS
= -fPIC
-shared
$(call cc-ldoption
, -Wl
$(comma
)--hash-style
=sysv
)
81 # Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
83 quiet_cmd_vdso_install
= INSTALL
$@
84 cmd_vdso_install
= cp
$(obj
)/$@.dbg
$(MODLIB
)/vdso
/$@
85 $(vdso-install-y
): %.so
: $(obj
)/%.so.dbg FORCE
86 @mkdir
-p
$(MODLIB
)/vdso
87 $(call cmd
,vdso_install
)
89 PHONY
+= vdso_install
$(vdso-install-y
)
90 vdso_install
: $(vdso-install-y
)