1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 20b24beccSAndrey RyabininKASAN_SANITIZE := n 38a16c09eSAndrey KonovalovUBSAN_SANITIZE := n 45c9a8750SDmitry VyukovKCOV_INSTRUMENT := n 50b24beccSAndrey Ryabinin 68a16c09eSAndrey Konovalov# Disable ftrace to avoid recursion. 7e2092740STorsten DuweCFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) 8e2092740STorsten DuweCFLAGS_REMOVE_generic.o = $(CC_FLAGS_FTRACE) 98a16c09eSAndrey KonovalovCFLAGS_REMOVE_init.o = $(CC_FLAGS_FTRACE) 108a16c09eSAndrey KonovalovCFLAGS_REMOVE_quarantine.o = $(CC_FLAGS_FTRACE) 118a16c09eSAndrey KonovalovCFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE) 1259fd51b2SAndrey KonovalovCFLAGS_REMOVE_report_generic.o = $(CC_FLAGS_FTRACE) 132e903b91SAndrey KonovalovCFLAGS_REMOVE_report_hw_tags.o = $(CC_FLAGS_FTRACE) 1459fd51b2SAndrey KonovalovCFLAGS_REMOVE_report_sw_tags.o = $(CC_FLAGS_FTRACE) 15bb359dbcSAndrey KonovalovCFLAGS_REMOVE_shadow.o = $(CC_FLAGS_FTRACE) 162e903b91SAndrey KonovalovCFLAGS_REMOVE_hw_tags.o = $(CC_FLAGS_FTRACE) 1759fd51b2SAndrey KonovalovCFLAGS_REMOVE_sw_tags.o = $(CC_FLAGS_FTRACE) 18dc15a8a2SAndrey Konovalov 190b24beccSAndrey Ryabinin# Function splitter causes unnecessary splits in __asan_load1/__asan_store1 200b24beccSAndrey Ryabinin# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533 21ca734cc6SAndrey KonovalovCC_FLAGS_KASAN_RUNTIME := $(call cc-option, -fno-conserve-stack) 22893ab004SMasahiro YamadaCC_FLAGS_KASAN_RUNTIME += -fno-stack-protector 23ca734cc6SAndrey Konovalov# Disable branch tracing to avoid recursion. 24ca734cc6SAndrey KonovalovCC_FLAGS_KASAN_RUNTIME += -DDISABLE_BRANCH_PROFILING 25ca734cc6SAndrey Konovalov 26ca734cc6SAndrey KonovalovCFLAGS_common.o := $(CC_FLAGS_KASAN_RUNTIME) 27ca734cc6SAndrey KonovalovCFLAGS_generic.o := $(CC_FLAGS_KASAN_RUNTIME) 28ca734cc6SAndrey KonovalovCFLAGS_init.o := $(CC_FLAGS_KASAN_RUNTIME) 29ca734cc6SAndrey KonovalovCFLAGS_quarantine.o := $(CC_FLAGS_KASAN_RUNTIME) 30ca734cc6SAndrey KonovalovCFLAGS_report.o := $(CC_FLAGS_KASAN_RUNTIME) 3159fd51b2SAndrey KonovalovCFLAGS_report_generic.o := $(CC_FLAGS_KASAN_RUNTIME) 322e903b91SAndrey KonovalovCFLAGS_report_hw_tags.o := $(CC_FLAGS_KASAN_RUNTIME) 3359fd51b2SAndrey KonovalovCFLAGS_report_sw_tags.o := $(CC_FLAGS_KASAN_RUNTIME) 34bb359dbcSAndrey KonovalovCFLAGS_shadow.o := $(CC_FLAGS_KASAN_RUNTIME) 352e903b91SAndrey KonovalovCFLAGS_hw_tags.o := $(CC_FLAGS_KASAN_RUNTIME) 3659fd51b2SAndrey KonovalovCFLAGS_sw_tags.o := $(CC_FLAGS_KASAN_RUNTIME) 370b24beccSAndrey Ryabinin 38*85f195b1SMarco ElverCFLAGS_KASAN_TEST := $(CFLAGS_KASAN) $(call cc-disable-warning, vla) 39*85f195b1SMarco Elverifndef CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX 40*85f195b1SMarco Elver# If compiler instruments memintrinsics by prefixing them with __asan/__hwasan, 41*85f195b1SMarco Elver# we need to treat them normally (as builtins), otherwise the compiler won't 42*85f195b1SMarco Elver# recognize them as instrumentable. If it doesn't instrument them, we need to 43*85f195b1SMarco Elver# pass -fno-builtin, so the compiler doesn't inline them. 44*85f195b1SMarco ElverCFLAGS_KASAN_TEST += -fno-builtin 45*85f195b1SMarco Elverendif 46f7e01ab8SAndrey Konovalov 47f7e01ab8SAndrey KonovalovCFLAGS_kasan_test.o := $(CFLAGS_KASAN_TEST) 48f7e01ab8SAndrey KonovalovCFLAGS_kasan_test_module.o := $(CFLAGS_KASAN_TEST) 49f7e01ab8SAndrey Konovalov 5009eb911dStangmengobj-y := common.o report.o 5159fd51b2SAndrey Konovalovobj-$(CONFIG_KASAN_GENERIC) += init.o generic.o report_generic.o shadow.o quarantine.o 52a0503b8aSKuan-Ying Leeobj-$(CONFIG_KASAN_HW_TAGS) += hw_tags.o report_hw_tags.o tags.o report_tags.o 53a0503b8aSKuan-Ying Leeobj-$(CONFIG_KASAN_SW_TAGS) += init.o report_sw_tags.o shadow.o sw_tags.o tags.o report_tags.o 54f7e01ab8SAndrey Konovalov 55f7e01ab8SAndrey Konovalovobj-$(CONFIG_KASAN_KUNIT_TEST) += kasan_test.o 56f7e01ab8SAndrey Konovalovobj-$(CONFIG_KASAN_MODULE_TEST) += kasan_test_module.o 57