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-vdso32 = vdso_user_wrapper-32.o note-32.o 10 11# Build rules 12 13targets := $(obj-vdso32) vdso32.so vdso32.so.dbg 14obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) 15 16KBUILD_AFLAGS += -DBUILD_VDSO 17KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING 18 19KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) 20KBUILD_AFLAGS_32 += -m31 -s 21 22KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) 23KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin 24 25LDFLAGS_vdso32.so.dbg += -fPIC -shared -nostdlib -soname=linux-vdso32.so.1 \ 26 --hash-style=both --build-id=sha1 -melf_s390 -T 27 28$(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) 29$(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32) 30 31obj-y += vdso32_wrapper.o 32targets += vdso32.lds 33CPPFLAGS_vdso32.lds += -P -C -U$(ARCH) 34 35# Disable gcov profiling, ubsan and kasan for VDSO code 36GCOV_PROFILE := n 37UBSAN_SANITIZE := n 38KASAN_SANITIZE := n 39 40# Force dependency (incbin is bad) 41$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so 42 43$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE 44 $(call if_changed,ld) 45 46# strip rule for the .so file 47$(obj)/%.so: OBJCOPYFLAGS := -S 48$(obj)/%.so: $(obj)/%.so.dbg FORCE 49 $(call if_changed,objcopy) 50 51$(obj-vdso32): %-32.o: %.S FORCE 52 $(call if_changed_dep,vdso32as) 53 54# actual build commands 55quiet_cmd_vdso32as = VDSO32A $@ 56 cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $< 57quiet_cmd_vdso32cc = VDSO32C $@ 58 cmd_vdso32cc = $(CC) $(c_flags) -c -o $@ $< 59 60# install commands for the unstripped file 61quiet_cmd_vdso_install = INSTALL $@ 62 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ 63 64vdso32.so: $(obj)/vdso32.so.dbg 65 @mkdir -p $(MODLIB)/vdso 66 $(call cmd,vdso_install) 67 68vdso_install: vdso32.so 69 70# Generate VDSO offsets using helper script 71gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh 72quiet_cmd_vdsosym = VDSOSYM $@ 73 cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ 74 75include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE 76 $(call if_changed,vdsosym) 77