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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
+10 -13
View File
@@ -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)