From 8e582455246f8f195c8a004b743c09f95423ffa4 Mon Sep 17 00:00:00 2001 From: cuiziwei Date: Fri, 22 Nov 2024 22:38:12 +0800 Subject: [PATCH] sim: Fix sim m32 start up crash issue. After compilation, when starting nsh, the following crash occurs. ==2500151==Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING. ==2500151==ASan shadow was supposed to be located in the [0x1ffff000-0x3fffffff] range. ==2500151==Process memory map follows: 0x30000000-0x33dd4000 /nuttx/nuttx To avoid overlaps, change the starting address of the text segment. Using Ttext-segment=0x30000000 causes a crash when starting the 32-bit SIM. Using -Ttext-segment=0x50000000 causes a crash when starting the 64-bit SIM. Setting -Ttext-segment=0x40000000 resolves all issues perfectly. Signed-off-by: cuiziwei --- arch/sim/src/cmake/Toolchain.cmake | 2 +- boards/sim/sim/sim/scripts/Make.defs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/sim/src/cmake/Toolchain.cmake b/arch/sim/src/cmake/Toolchain.cmake index bbfe239cac..68c9c911ea 100644 --- a/arch/sim/src/cmake/Toolchain.cmake +++ b/arch/sim/src/cmake/Toolchain.cmake @@ -196,5 +196,5 @@ if(APPLE) add_link_options(-Wl,-dead_strip) else() add_link_options(-Wl,--gc-sections) - add_link_options(-Wl,-Ttext-segment=0x30000000) + add_link_options(-Wl,-Ttext-segment=0x40000000) endif() diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs index 921828824a..90d3827424 100644 --- a/boards/sim/sim/sim/scripts/Make.defs +++ b/boards/sim/sim/sim/scripts/Make.defs @@ -296,9 +296,9 @@ ifeq ($(CONFIG_HOST_MACOS),y) else LDFLAGS += -Wl,--gc-sections - # Let the symbol table link from 0x30000000 + # Let the symbol table link from 0x40000000 # which is more convenient for debugging. - LDFLAGS += -Wl,-Ttext-segment=0x30000000 + LDFLAGS += -Wl,-Ttext-segment=0x40000000 endif ifeq ($(CONFIG_DEBUG_LINK_MAP),y)