arch: Add -fsanitize=kernel-address to ARCHCPUFLAGS if CONFIG_MM_KASAN=y

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-03-28 02:55:53 +08:00 committed by Petro Karashchenko
parent e87d262c7f
commit 8c8c60f70a
9 changed files with 36 additions and 0 deletions

View File

@ -73,6 +73,10 @@ else
MAXOPTIMIZATION += -fomit-frame-pointer MAXOPTIMIZATION += -fomit-frame-pointer
endif endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
# NuttX buildroot under Linux or Cygwin # NuttX buildroot under Linux or Cygwin
ifeq ($(CONFIG_ARM_TOOLCHAIN),BUILDROOT) ifeq ($(CONFIG_ARM_TOOLCHAIN),BUILDROOT)

View File

@ -81,6 +81,10 @@ ifeq ($(CONFIG_ARMV6M_TOOLCHAIN),GNU_EABI)
ARCHCPUFLAGS = -mcpu=cortex-m0 -mthumb -mfloat-abi=soft ARCHCPUFLAGS = -mcpu=cortex-m0 -mthumb -mfloat-abi=soft
endif endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
# Default toolchain # Default toolchain
CC = $(CROSSDEV)gcc CC = $(CROSSDEV)gcc

View File

@ -102,6 +102,10 @@ else
ARCHFPUFLAGS += -mfloat-abi=soft ARCHFPUFLAGS += -mfloat-abi=soft
endif endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL) MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL)
else else

View File

@ -130,6 +130,10 @@ else
endif endif
endif endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
# Generic GNU EABI toolchain # Generic GNU EABI toolchain
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),GNU_EABI) ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),GNU_EABI)

View File

@ -90,6 +90,10 @@ ifeq ($(CONFIG_ENDIAN_BIG),y)
ARCHCPUFLAGS += -mbig-endian ARCHCPUFLAGS += -mbig-endian
endif endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_ENDIAN_BIG),y) ifeq ($(CONFIG_ENDIAN_BIG),y)
TARGET_ARCH := armeb TARGET_ARCH := armeb
else else

View File

@ -128,6 +128,10 @@ else
endif endif
endif endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
# Generic GNU EABI toolchain # Generic GNU EABI toolchain
ifeq ($(CONFIG_ARMV8M_TOOLCHAIN),GNU_EABI) ifeq ($(CONFIG_ARMV8M_TOOLCHAIN),GNU_EABI)

View File

@ -115,6 +115,10 @@ ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)
endif endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
# Default toolchain # Default toolchain
CC = $(CROSSDEV)gcc CC = $(CROSSDEV)gcc

View File

@ -55,6 +55,10 @@ else
MAXOPTIMIZATION += -fomit-frame-pointer MAXOPTIMIZATION += -fomit-frame-pointer
endif endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
# Default toolchain # Default toolchain
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y) ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y)
CC = $(CROSSDEV)xcc CC = $(CROSSDEV)xcc

View File

@ -55,6 +55,10 @@ else
MAXOPTIMIZATION += -fomit-frame-pointer MAXOPTIMIZATION += -fomit-frame-pointer
endif endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
# Default toolchain # Default toolchain
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y) ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y)
CC = $(CROSSDEV)xcc CC = $(CROSSDEV)xcc