1# SPDX-License-Identifier: GPL-2.0 2 3# List of files in the vdso, has to be asm only for now 4 5ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN|R_PPC_REL24 6include $(srctree)/lib/vdso/Makefile 7 8obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o 9 10ifneq ($(c-gettimeofday-y),) 11 CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y) 12 CFLAGS_vgettimeofday.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 13 CFLAGS_vgettimeofday.o += $(call cc-option, -fno-stack-protector) 14 CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING 15 CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables 16 CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) 17endif 18 19# Build rules 20 21ifdef CROSS32_COMPILE 22 VDSOCC := $(CROSS32_COMPILE)gcc 23else 24 VDSOCC := $(CC) 25endif 26 27CC32FLAGS := 28ifdef CONFIG_PPC64 29CC32FLAGS += -m32 30KBUILD_CFLAGS := $(filter-out -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc,$(KBUILD_CFLAGS)) 31endif 32 33targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday.o 34obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) 35 36GCOV_PROFILE := n 37KCOV_INSTRUMENT := n 38UBSAN_SANITIZE := n 39KASAN_SANITIZE := n 40 41ccflags-y := -shared -fno-common -fno-builtin -nostdlib \ 42 -Wl,-soname=linux-vdso32.so.1 -Wl,--hash-style=both 43asflags-y := -D__VDSO32__ -s 44 45obj-y += vdso32_wrapper.o 46targets += vdso32.lds 47CPPFLAGS_vdso32.lds += -P -C -Upowerpc 48 49# link rule for the .so file, .lds has to be first 50$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday.o FORCE 51 $(call if_changed,vdso32ld_and_check) 52 53# assembly rules for the .S files 54$(obj-vdso32): %.o: %.S FORCE 55 $(call if_changed_dep,vdso32as) 56$(obj)/vgettimeofday.o: %.o: %.c FORCE 57 $(call if_changed_dep,vdso32cc) 58 59# Generate VDSO offsets using helper script 60gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh 61quiet_cmd_vdsosym = VDSOSYM $@ 62 cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ 63 64include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE 65 $(call if_changed,vdsosym) 66 67# actual build commands 68quiet_cmd_vdso32ld_and_check = VDSO32L $@ 69 cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) ; $(cmd_vdso_check) 70quiet_cmd_vdso32as = VDSO32A $@ 71 cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $< 72quiet_cmd_vdso32cc = VDSO32C $@ 73 cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $< 74