This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 1f2d1e97e8 x86-64: Added KASan compilation options 1f2d1e97e8 is described below commit 1f2d1e97e8fe500c165bf240d78eef3fe1edc403 Author: wangmingrong1 <wangmingro...@xiaomi.com> AuthorDate: Fri Nov 22 14:09:03 2024 +0800 x86-64: Added KASan compilation options Sorry for this commit: 6cd43777c3b6cf6480383a8f0401c976fc4731b3 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 <wangmingro...@xiaomi.com> --- arch/x86_64/src/Makefile | 4 ++++ arch/x86_64/src/common/Toolchain.defs | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/arch/x86_64/src/Makefile b/arch/x86_64/src/Makefile index ba55db152d..c16aff6621 100644 --- a/arch/x86_64/src/Makefile +++ b/arch/x86_64/src/Makefile @@ -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) diff --git a/arch/x86_64/src/common/Toolchain.defs b/arch/x86_64/src/common/Toolchain.defs index 67dc389445..77ecc2825c 100644 --- a/arch/x86_64/src/common/Toolchain.defs +++ b/arch/x86_64/src/common/Toolchain.defs @@ -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