1 # SPDX-License-Identifier: GPL-2.0 2 3 # List of files in the vdso, has to be asm only for now 4 5 ARCH_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 6 include $(srctree)/lib/vdso/Makefile 7 8 obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o 9 10 ifneq ($(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) 17 endif 18 19 # Build rules 20 21 ifdef CROSS32_COMPILE 22 VDSOCC := $(CROSS32_COMPILE)gcc 23 else 24 VDSOCC := $(CC) 25 endif 26 27 CC32FLAGS := 28 ifdef CONFIG_PPC64 29 CC32FLAGS += -m32 30 KBUILD_CFLAGS := $(filter-out -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc,$(KBUILD_CFLAGS)) 31 endif 32 33 targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday.o 34 obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) 35 36 GCOV_PROFILE := n 37 KCOV_INSTRUMENT := n 38 UBSAN_SANITIZE := n 39 KASAN_SANITIZE := n 40 41 ccflags-y := -shared -fno-common -fno-builtin -nostdlib \ 42 -Wl,-soname=linux-vdso32.so.1 -Wl,--hash-style=both 43 asflags-y := -D__VDSO32__ -s 44 45 obj-y += vdso32_wrapper.o 46 targets += vdso32.lds 47 CPPFLAGS_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 60 gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh 61 quiet_cmd_vdsosym = VDSOSYM $@ 62 cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ 63 64 include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE 65 $(call if_changed,vdsosym) 66 67 # actual build commands 68 quiet_cmd_vdso32ld_and_check = VDSO32L $@ 69 cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) ; $(cmd_vdso_check) 70 quiet_cmd_vdso32as = VDSO32A $@ 71 cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $< 72 quiet_cmd_vdso32cc = VDSO32C $@ 73 cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $< 74