1# SPDX-License-Identifier: GPL-2.0 2# List of files in the vdso 3 4KCOV_INSTRUMENT := n 5ARCH_REL_TYPE_ABS := R_390_COPY|R_390_GLOB_DAT|R_390_JMP_SLOT|R_390_RELATIVE 6ARCH_REL_TYPE_ABS += R_390_GOT|R_390_PLT 7 8include $(srctree)/lib/vdso/Makefile 9obj-vdso64 = vdso_user_wrapper.o note.o getcpu.o 10obj-cvdso64 = vdso64_generic.o 11CFLAGS_REMOVE_vdso64_generic.o = -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE) 12 13# Build rules 14 15targets := $(obj-vdso64) $(obj-cvdso64) vdso64.so vdso64.so.dbg 16obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) 17obj-cvdso64 := $(addprefix $(obj)/, $(obj-cvdso64)) 18 19KBUILD_AFLAGS += -DBUILD_VDSO 20KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING 21 22KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS)) 23KBUILD_AFLAGS_64 += -m64 -s 24 25KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) 26KBUILD_CFLAGS_64 += -m64 -fPIC -shared -fno-common -fno-builtin 27ldflags-y := -fPIC -shared -nostdlib -soname=linux-vdso64.so.1 \ 28 --hash-style=both --build-id=sha1 -T 29 30$(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64) 31$(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_64) 32 33obj-y += vdso64_wrapper.o 34targets += vdso64.lds 35CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) 36 37# Disable gcov profiling, ubsan and kasan for VDSO code 38GCOV_PROFILE := n 39UBSAN_SANITIZE := n 40KASAN_SANITIZE := n 41 42# Force dependency (incbin is bad) 43$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so 44 45# link rule for the .so file, .lds has to be first 46$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj-cvdso64) FORCE 47 $(call if_changed,ld) 48 49# strip rule for the .so file 50$(obj)/%.so: OBJCOPYFLAGS := -S 51$(obj)/%.so: $(obj)/%.so.dbg FORCE 52 $(call if_changed,objcopy) 53 54# assembly rules for the .S files 55$(obj-vdso64): %.o: %.S FORCE 56 $(call if_changed_dep,vdso64as) 57 58$(obj-cvdso64): %.o: %.c FORCE 59 $(call if_changed_dep,vdso64cc) 60 61# actual build commands 62quiet_cmd_vdso64as = VDSO64A $@ 63 cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $< 64quiet_cmd_vdso64cc = VDSO64C $@ 65 cmd_vdso64cc = $(CC) $(c_flags) -c -o $@ $< 66 67# install commands for the unstripped file 68quiet_cmd_vdso_install = INSTALL $@ 69 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ 70 71vdso64.so: $(obj)/vdso64.so.dbg 72 @mkdir -p $(MODLIB)/vdso 73 $(call cmd,vdso_install) 74 75vdso_install: vdso64.so 76