1 # SPDX-License-Identifier: GPL-2.0 2 # List of files in the vdso, has to be asm only for now 3 4 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 5 include $(srctree)/lib/vdso/Makefile 6 7 obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o 8 9 ifneq ($(c-gettimeofday-y),) 10 CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y) 11 CFLAGS_vgettimeofday.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 12 CFLAGS_vgettimeofday.o += $(call cc-option, -fno-stack-protector) 13 CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING 14 CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables 15 CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) 16 endif 17 18 # Build rules 19 20 targets := $(obj-vdso64) vdso64.so.dbg vgettimeofday.o 21 obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) 22 23 GCOV_PROFILE := n 24 KCOV_INSTRUMENT := n 25 UBSAN_SANITIZE := n 26 KASAN_SANITIZE := n 27 28 ccflags-y := -shared -fno-common -fno-builtin -nostdlib \ 29 -Wl,-soname=linux-vdso64.so.1 -Wl,--hash-style=both 30 31 # Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true 32 # by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is 33 # compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code 34 # generation is minimal, it will just use r29 instead. 35 ccflags-y += $(call cc-option, -ffixed-r30) 36 37 asflags-y := -D__VDSO64__ -s 38 39 targets += vdso64.lds 40 CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) 41 42 # link rule for the .so file, .lds has to be first 43 $(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday.o FORCE 44 $(call if_changed,vdso64ld_and_check) 45 46 # Generate VDSO offsets using helper script 47 gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh 48 quiet_cmd_vdsosym = VDSOSYM $@ 49 cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ 50 51 include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE 52 $(call if_changed,vdsosym) 53 54 # actual build commands 55 quiet_cmd_vdso64ld_and_check = VDSO64L $@ 56 cmd_vdso64ld_and_check = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check) 57