1 # SPDX-License-Identifier: GPL-2.0
2 # List of files in the vdso
5 ARCH_REL_TYPE_ABS := R_390_COPY|R_390_GLOB_DAT|R_390_JMP_SLOT|R_390_RELATIVE
6 ARCH_REL_TYPE_ABS += R_390_GOT|R_390_PLT
8 include $(srctree)/lib/vdso/Makefile
9 obj-vdso32 = vdso_user_wrapper-32.o note-32.o
13 targets := $(obj-vdso32) vdso32.so vdso32.so.dbg
14 obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
16 KBUILD_AFLAGS += -DBUILD_VDSO
17 KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING
19 KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS))
20 KBUILD_AFLAGS_32 += -m31 -s
22 KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS))
23 KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin
25 LDFLAGS_vdso32.so.dbg += -fPIC -shared -nostdlib -soname=linux-vdso32.so.1 \
26 --hash-style=both --build-id=sha1 -melf_s390 -T
28 $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
29 $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
31 obj-y += vdso32_wrapper.o
33 CPPFLAGS_vdso32.lds += -P -C -U$(ARCH)
35 # Disable gcov profiling, ubsan and kasan for VDSO code
41 # Force dependency (incbin is bad)
42 $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
44 $(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE
47 # strip rule for the .so file
48 $(obj)/%.so: OBJCOPYFLAGS := -S
49 $(obj)/%.so: $(obj)/%.so.dbg FORCE
50 $(call if_changed,objcopy)
52 $(obj-vdso32): %-32.o: %.S FORCE
53 $(call if_changed_dep,vdso32as)
55 # actual build commands
56 quiet_cmd_vdso32as = VDSO32A $@
57 cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<
58 quiet_cmd_vdso32cc = VDSO32C $@
59 cmd_vdso32cc = $(CC) $(c_flags) -c -o $@ $<
61 # install commands for the unstripped file
62 quiet_cmd_vdso_install = INSTALL $@
63 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
65 vdso32.so: $(obj)/vdso32.so.dbg
66 @mkdir -p $(MODLIB)/vdso
67 $(call cmd,vdso_install)
69 vdso_install: vdso32.so
71 # Generate VDSO offsets using helper script
72 gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
73 quiet_cmd_vdsosym = VDSOSYM $@
74 cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
76 include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE
77 $(call if_changed,vdsosym)