xref: /linux/arch/x86/um/vdso/Makefile (revision 831c1926ee728c3e747255f7c0f434762e8e863d)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
25c48b108SAl Viro#
35c48b108SAl Viro# Building vDSO images for x86.
45c48b108SAl Viro#
55c48b108SAl Viro
65c48b108SAl ViroVDSO64-y		:= y
75c48b108SAl Viro
85c48b108SAl Virovdso-install-$(VDSO64-y)	+= vdso.so
95c48b108SAl Viro
105c48b108SAl Viro
115c48b108SAl Viro# files to link into the vdso
125c48b108SAl Virovobjs-y := vdso-note.o um_vdso.o
135c48b108SAl Viro
145c48b108SAl Viro# files to link into kernel
155c48b108SAl Viroobj-$(VDSO64-y)			+= vdso.o vma.o
165c48b108SAl Viro
175c48b108SAl Virovobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
185c48b108SAl Viro
195c48b108SAl Viro$(obj)/vdso.o: $(obj)/vdso.so
205c48b108SAl Viro
215c48b108SAl Virotargets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
225c48b108SAl Viro
2361615fafSMasahiro YamadaCPPFLAGS_vdso.lds += -P -C
245c48b108SAl Viro
255c48b108SAl ViroVDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
26e4f752ddSNick Desaulniers       -Wl,-z,max-page-size=4096
275c48b108SAl Viro
285c48b108SAl Viro$(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
295c48b108SAl Viro
301742ed20SMasahiro Yamada$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
315c48b108SAl Viro	$(call if_changed,vdso)
325c48b108SAl Viro
335c48b108SAl Viro$(obj)/%.so: OBJCOPYFLAGS := -S
345c48b108SAl Viro$(obj)/%.so: $(obj)/%.so.dbg FORCE
355c48b108SAl Viro	$(call if_changed,objcopy)
365c48b108SAl Viro
375c48b108SAl Viro#
385c48b108SAl Viro# Don't omit frame pointers for ease of userspace debugging, but do
395c48b108SAl Viro# optimize sibling calls.
405c48b108SAl Viro#
415c48b108SAl ViroCFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
42893ab004SMasahiro Yamada       $(filter -g%,$(KBUILD_CFLAGS)) -fno-stack-protector \
435c48b108SAl Viro       -fno-omit-frame-pointer -foptimize-sibling-calls
445c48b108SAl Viro
455c48b108SAl Viro$(vobjs): KBUILD_CFLAGS += $(CFL)
465c48b108SAl Viro
475c48b108SAl Viro#
485c48b108SAl Viro# vDSO code runs in userspace and -pg doesn't help with profiling anyway.
495c48b108SAl Viro#
504d211093SAl ViroCFLAGS_REMOVE_vdso-note.o = -pg -fprofile-arcs -ftest-coverage
514d211093SAl ViroCFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage
525c48b108SAl Viro
535c48b108SAl Viro#
545c48b108SAl Viro# The DSO images are built using a special linker script.
555c48b108SAl Viro#
565c48b108SAl Viroquiet_cmd_vdso = VDSO    $@
575c48b108SAl Viro      cmd_vdso = $(CC) -nostdlib -o $@ \
5883e913f5SPeter Foley		       $(CC_FLAGS_LTO) $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
59*90daca7cSThomas Weißschuh		       -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^)
605c48b108SAl Viro
61*90daca7cSThomas WeißschuhVDSO_LDFLAGS = -fPIC -shared -Wl,--hash-style=sysv -z noexecstack -Wl,--no-undefined
62