mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
e56404e8e4
Don't use gcc plugins for building arch/arm64/kernel/vdso/vgettimeofday.c to avoid unneeded instrumentation. Signed-off-by: Alexander Popov <alex.popov@linux.com> Link: https://lore.kernel.org/r/20200624123330.83226-4-alex.popov@linux.com Signed-off-by: Will Deacon <will@kernel.org>
93 lines
2.8 KiB
Makefile
93 lines
2.8 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Building a vDSO image for AArch64.
|
|
#
|
|
# Author: Will Deacon <will.deacon@arm.com>
|
|
# Heavily based on the vDSO Makefiles for other archs.
|
|
#
|
|
|
|
# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
|
|
# the inclusion of generic Makefile.
|
|
ARCH_REL_TYPE_ABS := R_AARCH64_JUMP_SLOT|R_AARCH64_GLOB_DAT|R_AARCH64_ABS64
|
|
include $(srctree)/lib/vdso/Makefile
|
|
|
|
obj-vdso := vgettimeofday.o note.o sigreturn.o
|
|
|
|
# Build rules
|
|
targets := $(obj-vdso) vdso.so vdso.so.dbg
|
|
obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
|
|
|
|
btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti
|
|
|
|
# -Bsymbolic has been added for consistency with arm, the compat vDSO and
|
|
# potential future proofing if we end up with internal calls to the exported
|
|
# routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so
|
|
# preparation in build-time C")).
|
|
ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \
|
|
-Bsymbolic $(call ld-option, --no-eh-frame-hdr) --build-id -n \
|
|
$(btildflags-y) -T
|
|
|
|
ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18
|
|
ccflags-y += -DDISABLE_BRANCH_PROFILING
|
|
|
|
CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) $(GCC_PLUGINS_CFLAGS)
|
|
KBUILD_CFLAGS += $(DISABLE_LTO)
|
|
KASAN_SANITIZE := n
|
|
UBSAN_SANITIZE := n
|
|
OBJECT_FILES_NON_STANDARD := y
|
|
KCOV_INSTRUMENT := n
|
|
|
|
CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny -fasynchronous-unwind-tables
|
|
|
|
ifneq ($(c-gettimeofday-y),)
|
|
CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
|
|
endif
|
|
|
|
# Clang versions less than 8 do not support -mcmodel=tiny
|
|
ifeq ($(CONFIG_CC_IS_CLANG), y)
|
|
ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0)
|
|
CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny
|
|
endif
|
|
endif
|
|
|
|
# Disable gcov profiling for VDSO code
|
|
GCOV_PROFILE := n
|
|
|
|
obj-y += vdso.o
|
|
extra-y += vdso.lds
|
|
CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
|
|
|
|
# Force dependency (incbin is bad)
|
|
$(obj)/vdso.o : $(obj)/vdso.so
|
|
|
|
# Link rule for the .so file, .lds has to be first
|
|
$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
|
|
$(call if_changed,vdsold_and_vdso_check)
|
|
|
|
# Strip rule for the .so file
|
|
$(obj)/%.so: OBJCOPYFLAGS := -S
|
|
$(obj)/%.so: $(obj)/%.so.dbg FORCE
|
|
$(call if_changed,objcopy)
|
|
|
|
# Generate VDSO offsets using helper script
|
|
gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
|
|
quiet_cmd_vdsosym = VDSOSYM $@
|
|
cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
|
|
|
|
include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
|
|
$(call if_changed,vdsosym)
|
|
|
|
# Actual build commands
|
|
quiet_cmd_vdsold_and_vdso_check = LD $@
|
|
cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
|
|
|
|
# Install commands for the unstripped file
|
|
quiet_cmd_vdso_install = INSTALL $@
|
|
cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
|
|
|
|
vdso.so: $(obj)/vdso.so.dbg
|
|
@mkdir -p $(MODLIB)/vdso
|
|
$(call cmd,vdso_install)
|
|
|
|
vdso_install: vdso.so
|