x86-64: Added KASan compilation options

Sorry for this commit: 6cd43777c3
This is the real x86-64 modification, and this patch is x86
Fortunately, except for the error in the previous modification, the actual architecture is supported

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
wangmingrong1 2024-11-22 14:09:03 +08:00 committed by Xiang Xiao
parent 5ec2c97424
commit 1f2d1e97e8
2 changed files with 17 additions and 0 deletions

View file

@ -131,6 +131,10 @@ ifeq ($(CONFIG_ALLSYMS),y)
EXTRA_LIBS += allsyms$(OBJEXT)
endif
ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
EXTRA_LIBS += kasan_globals$(OBJEXT)
endif
define LINK_ALLSYMS_KASAN
$(if $(CONFIG_ALLSYMS),
$(Q) $(TOPDIR)/tools/mkallsyms.py $(NUTTX) allsyms.tmp --orderbyname $(CONFIG_SYMTAB_ORDEREDBYNAME)

View file

@ -127,6 +127,19 @@ ifeq ($(CONFIG_LIBCXX),y)
CXXFLAGS += -D_LIBCPP_DISABLE_AVAILABILITY
endif
ifeq ($(CONFIG_MM_KASAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
ARCHOPTIMIZATION += --param asan-globals=1
endif
ifeq ($(CONFIG_MM_KASAN_DISABLE_READS_CHECK),y)
ARCHOPTIMIZATION += --param asan-instrument-reads=0
endif
ifeq ($(CONFIG_MM_KASAN_DISABLE_WRITES_CHECK),y)
ARCHOPTIMIZATION += --param asan-instrument-writes=0
endif
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E -x c