arch: Move -fsanitize=kernel-address to ARCHOPTIMIZATION

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-05-15 09:42:07 +08:00 committed by Petro Karashchenko
parent 4f090eb7fd
commit 8b7c5b039d
11 changed files with 20 additions and 23 deletions

View File

@ -80,7 +80,7 @@ ifeq ($(CONFIG_ARCH_COVERAGE),y)
endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
# NuttX buildroot under Linux or Cygwin

View File

@ -154,7 +154,7 @@ endif
# Architecture flags
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
ARCHCFLAGS += -fno-common

View File

@ -97,7 +97,7 @@ else
endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)

View File

@ -172,7 +172,7 @@ endif
endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
# Generic GNU EABI toolchain

View File

@ -97,7 +97,7 @@ ifeq ($(CONFIG_ENDIAN_BIG),y)
endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_ENDIAN_BIG),y)

View File

@ -181,7 +181,7 @@ endif
endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
# Generic GNU EABI toolchain

View File

@ -141,7 +141,7 @@ endif
# Architecture flags
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
ARCHCFLAGS += -fno-common

View File

@ -153,7 +153,7 @@ ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)
endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
# Default toolchain

View File

@ -44,7 +44,7 @@ endif
ARCHCPUFLAGS = -mlongcalls
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)

View File

@ -44,7 +44,7 @@ endif
ARCHCPUFLAGS = -mlongcalls
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)

View File

@ -71,6 +71,16 @@ ifeq ($(CONFIG_ARCH_COVERAGE),y)
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
endif
ifeq ($(CONFIG_SIM_ASAN),y)
ARCHOPTIMIZATION += -fsanitize=address
else ifeq ($(CONFIG_MM_KASAN),y)
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_SIM_UBSAN),y)
ARCHOPTIMIZATION += -fsanitize=undefined
endif
# Add -fno-common because macOS "ld -r" doesn't seem to pick objects
# for common symbols.
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
@ -141,19 +151,6 @@ ifeq ($(CONFIG_LIBCXX),y)
CXXFLAGS += -D_LIBCPP_DISABLE_AVAILABILITY
endif
ifeq ($(CONFIG_SIM_ASAN),y)
CFLAGS += -fsanitize=address
CXXFLAGS += -fsanitize=address
else ifeq ($(CONFIG_MM_KASAN),y)
CFLAGS += -fsanitize=kernel-address
CXXFLAGS += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_SIM_UBSAN),y)
CFLAGS += -fsanitize=undefined
CXXFLAGS += -fsanitize=undefined
endif
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS)