mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
arch: Move -fsanitize=kernel-address to ARCHOPTIMIZATION
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
4f090eb7fd
commit
8b7c5b039d
@@ -80,7 +80,7 @@ ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# NuttX buildroot under Linux or Cygwin
|
# NuttX buildroot under Linux or Cygwin
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ endif
|
|||||||
# Architecture flags
|
# Architecture flags
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ARCHCFLAGS += -fno-common
|
ARCHCFLAGS += -fno-common
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Generic GNU EABI toolchain
|
# Generic GNU EABI toolchain
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ ifeq ($(CONFIG_ENDIAN_BIG),y)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ENDIAN_BIG),y)
|
ifeq ($(CONFIG_ENDIAN_BIG),y)
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Generic GNU EABI toolchain
|
# Generic GNU EABI toolchain
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ endif
|
|||||||
# Architecture flags
|
# Architecture flags
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ARCHCFLAGS += -fno-common
|
ARCHCFLAGS += -fno-common
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Default toolchain
|
# Default toolchain
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ endif
|
|||||||
ARCHCPUFLAGS = -mlongcalls
|
ARCHCPUFLAGS = -mlongcalls
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ endif
|
|||||||
ARCHCPUFLAGS = -mlongcalls
|
ARCHCPUFLAGS = -mlongcalls
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_KASAN),y)
|
ifeq ($(CONFIG_MM_KASAN),y)
|
||||||
ARCHCPUFLAGS += -fsanitize=kernel-address
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
||||||
|
|||||||
@@ -71,6 +71,16 @@ ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
|||||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||||
endif
|
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
|
# Add -fno-common because macOS "ld -r" doesn't seem to pick objects
|
||||||
# for common symbols.
|
# for common symbols.
|
||||||
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
|
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
|
||||||
@@ -141,19 +151,6 @@ ifeq ($(CONFIG_LIBCXX),y)
|
|||||||
CXXFLAGS += -D_LIBCPP_DISABLE_AVAILABILITY
|
CXXFLAGS += -D_LIBCPP_DISABLE_AVAILABILITY
|
||||||
endif
|
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
|
# Loadable module definitions
|
||||||
|
|
||||||
CMODULEFLAGS = $(CFLAGS)
|
CMODULEFLAGS = $(CFLAGS)
|
||||||
|
|||||||
Reference in New Issue
Block a user