xref: /openbmc/linux/arch/s390/kernel/vdso32/Makefile (revision aff69273)
1779df224SSven Schnelle# SPDX-License-Identifier: GPL-2.0
2779df224SSven Schnelle# List of files in the vdso
3779df224SSven Schnelle
4779df224SSven SchnelleKCOV_INSTRUMENT := n
5779df224SSven Schnelle
6*aff69273SFangrui 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))
22779df224SSven SchnelleKBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin
23779df224SSven Schnelle
247b737adcSMasahiro YamadaLDFLAGS_vdso32.so.dbg += -fPIC -shared -soname=linux-vdso32.so.1 \
25779df224SSven Schnelle	--hash-style=both --build-id=sha1 -melf_s390 -T
26779df224SSven Schnelle
27779df224SSven Schnelle$(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
28779df224SSven Schnelle$(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
29779df224SSven Schnelle
30779df224SSven Schnelleobj-y += vdso32_wrapper.o
3198f7cd23SSven Schnelletargets += vdso32.lds
32779df224SSven SchnelleCPPFLAGS_vdso32.lds += -P -C -U$(ARCH)
33779df224SSven Schnelle
34779df224SSven Schnelle# Disable gcov profiling, ubsan and kasan for VDSO code
35779df224SSven SchnelleGCOV_PROFILE := n
36779df224SSven SchnelleUBSAN_SANITIZE := n
37779df224SSven SchnelleKASAN_SANITIZE := n
38e37b3dd0SIlya LeoshkevichKCSAN_SANITIZE := n
39779df224SSven Schnelle
40779df224SSven Schnelle# Force dependency (incbin is bad)
41779df224SSven Schnelle$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
42779df224SSven Schnelle
43779df224SSven Schnelle$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE
44779df224SSven Schnelle	$(call if_changed,ld)
45779df224SSven Schnelle
46779df224SSven Schnelle# strip rule for the .so file
47779df224SSven Schnelle$(obj)/%.so: OBJCOPYFLAGS := -S
48779df224SSven Schnelle$(obj)/%.so: $(obj)/%.so.dbg FORCE
49779df224SSven Schnelle	$(call if_changed,objcopy)
50779df224SSven Schnelle
51779df224SSven Schnelle$(obj-vdso32): %-32.o: %.S FORCE
52779df224SSven Schnelle	$(call if_changed_dep,vdso32as)
53779df224SSven Schnelle
54779df224SSven Schnelle# actual build commands
55779df224SSven Schnellequiet_cmd_vdso32as = VDSO32A $@
56779df224SSven Schnelle      cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<
57779df224SSven Schnellequiet_cmd_vdso32cc = VDSO32C $@
58779df224SSven Schnelle      cmd_vdso32cc = $(CC) $(c_flags) -c -o $@ $<
59779df224SSven Schnelle
60779df224SSven Schnelle# install commands for the unstripped file
61779df224SSven Schnellequiet_cmd_vdso_install = INSTALL $@
62779df224SSven Schnelle      cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
63779df224SSven Schnelle
64779df224SSven Schnellevdso32.so: $(obj)/vdso32.so.dbg
65779df224SSven Schnelle	@mkdir -p $(MODLIB)/vdso
66779df224SSven Schnelle	$(call cmd,vdso_install)
67779df224SSven Schnelle
68779df224SSven Schnellevdso_install: vdso32.so
69779df224SSven Schnelle
70779df224SSven Schnelle# Generate VDSO offsets using helper script
71779df224SSven Schnellegen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
72779df224SSven Schnellequiet_cmd_vdsosym = VDSOSYM $@
73779df224SSven Schnelle	cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
74779df224SSven Schnelle
75779df224SSven Schnelleinclude/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE
76779df224SSven Schnelle	$(call if_changed,vdsosym)
77