xref: /openbmc/linux/arch/s390/kernel/vdso32/Makefile (revision 2028823f)
1779df224SSven Schnelle# SPDX-License-Identifier: GPL-2.0
2779df224SSven Schnelle# List of files in the vdso
3779df224SSven Schnelle
4779df224SSven SchnelleKCOV_INSTRUMENT := n
5779df224SSven Schnelle
6aff69273SFangrui Song# Include the generic Makefile to check the built vdso.
7779df224SSven Schnelleinclude $(srctree)/lib/vdso/Makefile
8779df224SSven Schnelleobj-vdso32 = vdso_user_wrapper-32.o note-32.o
9779df224SSven Schnelle
10779df224SSven Schnelle# Build rules
11779df224SSven Schnelle
12779df224SSven Schnelletargets := $(obj-vdso32) vdso32.so vdso32.so.dbg
13779df224SSven Schnelleobj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
14779df224SSven Schnelle
15779df224SSven SchnelleKBUILD_AFLAGS += -DBUILD_VDSO
16779df224SSven SchnelleKBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING
17779df224SSven Schnelle
18779df224SSven SchnelleKBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS))
19779df224SSven SchnelleKBUILD_AFLAGS_32 += -m31 -s
20779df224SSven Schnelle
21779df224SSven SchnelleKBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS))
222028823fSHeiko CarstensKBUILD_CFLAGS_32 := $(filter-out -mpacked-stack,$(KBUILD_CFLAGS))
23d15e4314SSumanth KorikkarKBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32))
24a4228691SJens RemusKBUILD_CFLAGS_32 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_32))
25a4228691SJens RemusKBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin -fasynchronous-unwind-tables
26779df224SSven Schnelle
27d19c74e2SNathan ChancellorLDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \
28779df224SSven Schnelle	--hash-style=both --build-id=sha1 -melf_s390 -T
29779df224SSven Schnelle
30779df224SSven Schnelle$(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
31779df224SSven Schnelle$(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
32779df224SSven Schnelle
33779df224SSven Schnelleobj-y += vdso32_wrapper.o
3498f7cd23SSven Schnelletargets += vdso32.lds
35779df224SSven SchnelleCPPFLAGS_vdso32.lds += -P -C -U$(ARCH)
36779df224SSven Schnelle
37779df224SSven Schnelle# Disable gcov profiling, ubsan and kasan for VDSO code
38779df224SSven SchnelleGCOV_PROFILE := n
39779df224SSven SchnelleUBSAN_SANITIZE := n
40779df224SSven SchnelleKASAN_SANITIZE := n
41e37b3dd0SIlya LeoshkevichKCSAN_SANITIZE := n
42779df224SSven Schnelle
43779df224SSven Schnelle# Force dependency (incbin is bad)
44779df224SSven Schnelle$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
45779df224SSven Schnelle
460dd0bbc2SSven Schnellequiet_cmd_vdso_and_check = VDSO    $@
470dd0bbc2SSven Schnelle      cmd_vdso_and_check = $(cmd_ld); $(cmd_vdso_check)
480dd0bbc2SSven Schnelle
49779df224SSven Schnelle$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE
500dd0bbc2SSven Schnelle	$(call if_changed,vdso_and_check)
51779df224SSven Schnelle
52779df224SSven Schnelle# strip rule for the .so file
53779df224SSven Schnelle$(obj)/%.so: OBJCOPYFLAGS := -S
54779df224SSven Schnelle$(obj)/%.so: $(obj)/%.so.dbg FORCE
55779df224SSven Schnelle	$(call if_changed,objcopy)
56779df224SSven Schnelle
57779df224SSven Schnelle$(obj-vdso32): %-32.o: %.S FORCE
58779df224SSven Schnelle	$(call if_changed_dep,vdso32as)
59779df224SSven Schnelle
60779df224SSven Schnelle# actual build commands
61779df224SSven Schnellequiet_cmd_vdso32as = VDSO32A $@
62779df224SSven Schnelle      cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<
63779df224SSven Schnellequiet_cmd_vdso32cc = VDSO32C $@
64779df224SSven Schnelle      cmd_vdso32cc = $(CC) $(c_flags) -c -o $@ $<
65779df224SSven Schnelle
66779df224SSven Schnelle# Generate VDSO offsets using helper script
67779df224SSven Schnellegen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
68779df224SSven Schnellequiet_cmd_vdsosym = VDSOSYM $@
69779df224SSven Schnelle	cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
70779df224SSven Schnelle
71779df224SSven Schnelleinclude/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE
72779df224SSven Schnelle	$(call if_changed,vdsosym)
73